35 lines
970 B
TypeScript
35 lines
970 B
TypeScript
import { httpDeleteInterceptor, httpGet, httpPost, httpPut } from "./http-config/axios-base-service";
|
|
|
|
export async function getListArticle() {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
return await httpGet(`/articles`, headers);
|
|
}
|
|
|
|
export async function createArticle(data: any) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
const pathUrl = `/articles`;
|
|
return await httpPost(pathUrl, headers, data);
|
|
}
|
|
|
|
export async function updateArticle(id: any) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
const pathUrl = `/articles/${id}`;
|
|
return await httpPut(pathUrl, headers);
|
|
}
|
|
|
|
export async function getArticleById(id: any) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
return await httpGet(`/articles/${id}`, headers);
|
|
}
|
|
|
|
export async function deleteArticle(id: string) {
|
|
return await httpDeleteInterceptor(`articles/${id}`);
|
|
} |