fix:bearer

This commit is contained in:
Rama Priyanto 2025-08-29 13:43:53 +07:00
parent 362aae6729
commit 92bea89d29
11 changed files with 38 additions and 0 deletions

View File

@ -19,6 +19,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);
@ -45,6 +46,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);
@ -69,6 +71,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);

View File

@ -118,6 +118,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);
@ -148,6 +149,7 @@ export async function getRecapArticleData(data: any) {
export async function deleteArticle(id: string) {
const headers = {
"content-type": "application/json",
Authorization: `Bearer ${token}`,
};
return await httpPut(`articles/delete/${id}`, headers);
}
@ -174,12 +176,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);
}
@ -193,6 +197,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);
}
@ -297,6 +302,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);

View File

@ -21,6 +21,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);
}
@ -39,6 +40,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);

View File

@ -11,6 +11,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);
@ -38,6 +39,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);
}

View File

@ -34,6 +34,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);
@ -49,6 +50,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}`, headers);
}
@ -56,6 +58,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);
}
@ -63,6 +66,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);
}
@ -70,6 +74,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}`, headers);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -37,6 +37,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);
}

View File

@ -26,6 +26,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);
@ -55,6 +56,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);
}
@ -62,6 +64,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);
}
@ -101,6 +104,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);
}
@ -108,6 +112,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 });
}
@ -165,6 +170,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);
}

View File

@ -5,10 +5,13 @@ import {
httpPost,
httpPut,
} from "./http-config/axios-base-service";
import Cookies from "js-cookie";
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);
@ -17,6 +20,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);

View File

@ -37,6 +37,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);
}