24 lines
618 B
TypeScript
24 lines
618 B
TypeScript
|
|
import apiClient from "@/api/client";
|
||
|
|
|
||
|
|
export const getNewsApi = async (page = 1, limit = 10) => {
|
||
|
|
const res = await apiClient.get(
|
||
|
|
`/newsMedia/getAll?page=${page}&limit=${limit}`,
|
||
|
|
);
|
||
|
|
return res.data;
|
||
|
|
};
|
||
|
|
|
||
|
|
export const createNewsApi = async (data: any) => {
|
||
|
|
const res = await apiClient.post("/newsMedia", data);
|
||
|
|
return res.data;
|
||
|
|
};
|
||
|
|
|
||
|
|
export const updateNewsApi = async (id: number, data: any) => {
|
||
|
|
const res = await apiClient.patch(`/newsMedia/${id}`, data);
|
||
|
|
return res.data;
|
||
|
|
};
|
||
|
|
|
||
|
|
export const deleteNewsApi = async (id: number) => {
|
||
|
|
const res = await apiClient.delete(`/newsMedia/${id}`);
|
||
|
|
return res.data;
|
||
|
|
};
|