This commit is contained in:
hamid zarghami
2026-07-04 09:45:24 +03:30
parent bcf03887f1
commit eb9973678c
18 changed files with 762 additions and 20 deletions
@@ -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;
};