slider
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import axios from "@/config/axios";
|
||||
import type {
|
||||
CreateSliderType,
|
||||
GetSlidersParams,
|
||||
SliderResponse,
|
||||
SlidersResponse,
|
||||
} from "../types/Types";
|
||||
|
||||
export const getSliders = async (
|
||||
params?: GetSlidersParams
|
||||
): Promise<SlidersResponse> => {
|
||||
const { data } = await axios.get<SlidersResponse>("/admin/sliders", { params });
|
||||
return data;
|
||||
};
|
||||
|
||||
export const createSlider = async (params: CreateSliderType) => {
|
||||
const { data } = await axios.post("/admin/sliders", params);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const deleteSlider = async (id: string) => {
|
||||
const { data } = await axios.delete(`/admin/sliders/${id}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getSlider = async (id: string): Promise<SliderResponse> => {
|
||||
const { data } = await axios.get<SliderResponse>(`/admin/sliders/${id}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const updateSlider = async (id: string, params: CreateSliderType) => {
|
||||
const { data } = await axios.patch(`/admin/sliders/${id}`, params);
|
||||
return data;
|
||||
};
|
||||
Reference in New Issue
Block a user