web-humas-fe/service/article.ts

35 lines
970 B
TypeScript
Raw Normal View History

2024-04-24 04:14:06 +00:00
import { httpDeleteInterceptor, httpGet, httpPost, httpPut } from "./http-config/axios-base-service";
2024-04-04 10:30:07 +00:00
export async function getListArticle() {
const headers = {
"content-type": "application/json",
};
return await httpGet(`/articles`, headers);
2024-04-19 13:26:27 +00:00
}
export async function createArticle(data: any) {
2024-04-24 04:14:06 +00:00
const headers = {
"content-type": "application/json",
};
2024-04-19 13:26:27 +00:00
const pathUrl = `/articles`;
2024-04-24 04:14:06 +00:00
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}`);
2024-04-04 10:30:07 +00:00
}