feat:bearer token
This commit is contained in:
commit
a00d63aa8d
|
|
@ -18,6 +18,7 @@ export async function createAdvertise(data: any) {
|
|||
export async function createMediaFileAdvertise(id: string | number, data: any) {
|
||||
const headers = {
|
||||
"content-type": "multipart/form-data",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/advertisement/upload/${id}`;
|
||||
return await httpPost(pathUrl, headers, data);
|
||||
|
|
@ -58,6 +59,7 @@ export async function createAdvertiseById(id: number) {
|
|||
export async function editAdvertise(data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/advertisement/${data?.id}`;
|
||||
return await httpPut(pathUrl, headers, data);
|
||||
|
|
@ -82,6 +84,7 @@ export async function editAdvertiseIsActive(data: any) {
|
|||
export async function deleteAdvertise(id: number) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/advertisement/delete/${id}`;
|
||||
return await httpPut(pathUrl, headers);
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ export async function createArticleSchedule(data: any) {
|
|||
export async function updateArticle(id: string, data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/articles/${id}`;
|
||||
return await httpPut(pathUrl, headers, data);
|
||||
|
|
@ -173,12 +174,14 @@ export async function getCategoryPagination(data: any) {
|
|||
export async function uploadArticleFile(id: string, data: any) {
|
||||
const headers = {
|
||||
"content-type": "multipart/form-data",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPost(`/article-files/${id}`, headers, data);
|
||||
}
|
||||
export async function uploadArticleThumbnail(id: string, data: any) {
|
||||
const headers = {
|
||||
"content-type": "multipart/form-data",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPost(`/articles/thumbnail/${id}`, headers, data);
|
||||
}
|
||||
|
|
@ -192,6 +195,7 @@ export async function uploadArticleThumbnail(id: string, data: any) {
|
|||
export async function deleteArticleFiles(id: number) {
|
||||
const headers = {
|
||||
"content-type": "multipart/form-data",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPut(`article-files/delete/${id}`, headers);
|
||||
}
|
||||
|
|
@ -307,6 +311,7 @@ export async function submitApproval(data: {
|
|||
export async function updateIsBannerArticle(id: number, status: boolean) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/articles/banner/${id}?isBanner=${status}`;
|
||||
return await httpPut(pathUrl, headers);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ export async function getComments(data: any) {
|
|||
export async function deleteComment(id: number) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpDeleteInterceptor(`/article-comments/${id}`, headers);
|
||||
}
|
||||
|
|
@ -42,6 +43,7 @@ export async function saveCommentStatus(data: {
|
|||
}) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/article-comments/approval`;
|
||||
return await httpPost(pathUrl, headers, data);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ const token = Cookies.get("access_token");
|
|||
export async function createFeedback(data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/feedbacks`;
|
||||
return await httpPost(pathUrl, headers, data);
|
||||
|
|
@ -39,6 +40,7 @@ export async function getFeedbacksById(id: number) {
|
|||
export async function deleteFeedback(id: number) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpDeleteInterceptor(`/feedbacks/${id}`, headers);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export async function getListMagazine(props: PaginationRequest) {
|
|||
export async function updateMagazine(id: string, data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/magazines/${id}`;
|
||||
return await httpPut(pathUrl, headers, data);
|
||||
|
|
@ -45,6 +46,7 @@ export async function getMagazineById(id: string) {
|
|||
export async function deleteMagazine(id: string) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpDeleteInterceptor(`magazines/${id}`);
|
||||
}
|
||||
|
|
@ -52,6 +54,7 @@ export async function deleteMagazine(id: string) {
|
|||
export async function uploadMagazineFile(id: string, data: any) {
|
||||
const headers = {
|
||||
"content-type": "multipart/form-data",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPost(`/magazine-files/${id}`, headers, data);
|
||||
}
|
||||
|
|
@ -59,6 +62,7 @@ export async function uploadMagazineFile(id: string, data: any) {
|
|||
export async function uploadMagazineThumbnail(id: string, data: any) {
|
||||
const headers = {
|
||||
"content-type": "multipart/form-data",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPost(`/magazines/thumbnail/${id}`, headers, data);
|
||||
}
|
||||
|
|
@ -66,6 +70,7 @@ export async function uploadMagazineThumbnail(id: string, data: any) {
|
|||
export async function deleteMagazineFiles(id: number) {
|
||||
const headers = {
|
||||
"content-type": "multipart/form-data",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpDeleteInterceptor(`magazine-files/${id}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ export async function createCategory(data: any) {
|
|||
export async function updateCategory(id: string, data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/article-categories/${id}`;
|
||||
return await httpPut(pathUrl, headers, data);
|
||||
|
|
@ -41,6 +42,7 @@ export async function getCategoryById(id: number) {
|
|||
export async function deleteCategory(id: number) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPut(`article-categories/delete/${id}`, headers);
|
||||
}
|
||||
|
|
@ -48,6 +50,7 @@ export async function deleteCategory(id: number) {
|
|||
export async function uploadCategoryThumbnail(id: string, data: any) {
|
||||
const headers = {
|
||||
"content-type": "multipart/form-data",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPost(`/article-categories/thumbnail/${id}`, headers, data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import Cookies from "js-cookie";
|
||||
import {
|
||||
httpDeleteInterceptor,
|
||||
httpGet,
|
||||
|
|
@ -5,6 +6,8 @@ import {
|
|||
httpPut,
|
||||
} from "./http-config/axios-base-service";
|
||||
|
||||
const token = Cookies.get("access_token");
|
||||
|
||||
export async function createUserLevel(data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
|
|
@ -16,6 +19,7 @@ export async function createUserLevel(data: any) {
|
|||
export async function getUserLevel() {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpGet(`/user-levels?levelNumber=2&parentLevelId=79`, headers);
|
||||
}
|
||||
|
|
@ -23,6 +27,7 @@ export async function getUserLevel() {
|
|||
export async function editUserLevel(data: any, id: number) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/user-levels/${id}`;
|
||||
return await httpPut(pathUrl, headers, data);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export async function getMasterUserRoleById(id: any) {
|
|||
export async function deleteMasterUserRole(id: string) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpDeleteInterceptor(`/user-roles/${id}`, headers);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ export async function listMasterUsers(data: any) {
|
|||
export async function createMasterUser(data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/users`;
|
||||
return await httpPost(pathUrl, headers, data);
|
||||
|
|
@ -57,6 +58,7 @@ export async function getDetailMasterUsers(id: string) {
|
|||
export async function editMasterUsers(data: any, id: string) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPut(`/users/${id}`, headers, data);
|
||||
}
|
||||
|
|
@ -64,6 +66,7 @@ export async function editMasterUsers(data: any, id: string) {
|
|||
export async function deleteMasterUser(id: string) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpDeleteInterceptor(`/users/${id}`, headers);
|
||||
}
|
||||
|
|
@ -103,6 +106,7 @@ export async function savePassword(data: any) {
|
|||
export async function resetPassword(data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPost(`/users/reset-password`, headers, data);
|
||||
}
|
||||
|
|
@ -110,6 +114,7 @@ export async function resetPassword(data: any) {
|
|||
export async function checkUsernames(username: string) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPost(`/users/forgot-password`, headers, { username });
|
||||
}
|
||||
|
|
@ -167,6 +172,7 @@ export async function getArticleComment(id: string) {
|
|||
export async function deleteArticleComment(id: number) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpDeleteInterceptor(`/article-comments/${id}`, headers);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,14 @@ import {
|
|||
httpPost,
|
||||
httpPut,
|
||||
} from "./http-config/axios-base-service";
|
||||
import Cookies from "js-cookie";
|
||||
import { httpGetInterceptor } from "./http-config/http-interceptor-services";
|
||||
const token = Cookies.get("access_token");
|
||||
|
||||
export async function createCustomStaticPage(data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/custom-static-pages`;
|
||||
return await httpPost(pathUrl, headers, data);
|
||||
|
|
@ -18,6 +21,7 @@ export async function createCustomStaticPage(data: any) {
|
|||
export async function editCustomStaticPage(data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const pathUrl = `/custom-static-pages/${data.id}`;
|
||||
return await httpPut(pathUrl, headers, data);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ export async function getAccountById(id: string) {
|
|||
export async function createUserLevels(request: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpPost(`user-levels`, headers, request);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue