fix:delete to put method

This commit is contained in:
Rama Priyanto 2025-06-12 10:04:04 +07:00
commit 2b5accd391
7 changed files with 34 additions and 9 deletions

View File

@ -196,7 +196,6 @@ export default function FormMasterUser() {
const fetchUserLevel = async () => { const fetchUserLevel = async () => {
loading(); loading();
const request = { const request = {
limit: 1000, limit: 1000,
page: 1, page: 1,

View File

@ -158,7 +158,7 @@ export default function Login() {
// Cookies.set("email", profile?.data?.data?.email, { // Cookies.set("email", profile?.data?.data?.email, {
// expires: 1, // expires: 1,
// }); // });
// router.push(`/admin/dashboard?timestamp=${getUnixTimestamp()}`); // router.push("/admin/dashboard");
// Cookies.set("status", "login", { // Cookies.set("status", "login", {
// expires: 1, // expires: 1,
// }); // });

View File

@ -160,7 +160,7 @@ export default function HeaderNews() {
</p> </p>
<ScrollShadow hideScrollBar className="h-[29vh] lg:h-[400px] "> <ScrollShadow hideScrollBar className="h-[29vh] lg:h-[400px] ">
{hotNews?.length > 0 ? ( {hotNews?.length > 0 ? (
hotNews.map((data: any, index: number) => ( hotNews?.map((data: any, index: number) => (
<div <div
className="text-xs text-left m-2 p-2 dark:bg-[#1E1616] bg-white rounded-md flex flex-row gap-2" className="text-xs text-left m-2 p-2 dark:bg-[#1E1616] bg-white rounded-md flex flex-row gap-2"
key={data?.id} key={data?.id}
@ -249,7 +249,7 @@ export default function HeaderNews() {
); );
}} }}
> >
{hotNews.map((newsItem: any, index: number) => ( {hotNews?.map((newsItem: any, index: number) => (
<SwiperSlide key={newsItem?.id} className="!w-full h-[50vh]"> <SwiperSlide key={newsItem?.id} className="!w-full h-[50vh]">
<Card <Card
isFooterBlurred isFooterBlurred

View File

@ -247,6 +247,7 @@ export default function ArticleTable() {
} }
close(); close();
success("Berhasil Hapus"); success("Berhasil Hapus");
setPage(1);
initState(); initState();
} }

View File

@ -72,10 +72,17 @@ export async function editAdvertiseIsActive(data: any) {
return await httpPut(pathUrl, headers); return await httpPut(pathUrl, headers);
} }
// export async function deleteAdvertise(id: number) {
// const headers = {
// "content-type": "application/json",
// };
// const pathUrl = `/advertisement/${id}`;
// return await httpDeleteInterceptor(pathUrl, headers);
// }
export async function deleteAdvertise(id: number) { export async function deleteAdvertise(id: number) {
const headers = { const headers = {
"content-type": "application/json", "content-type": "application/json",
}; };
const pathUrl = `/advertisement/${id}`; const pathUrl = `/advertisement/delete/${id}`;
return await httpDeleteInterceptor(pathUrl); return await httpPut(pathUrl, headers);
} }

View File

@ -128,12 +128,18 @@ export async function getArticleById(id: any) {
return await httpGet(`/articles/${id}`, headers); return await httpGet(`/articles/${id}`, headers);
} }
// export async function deleteArticle(id: string) {
// const headers = {
// "content-type": "application/json",
// };
// return await httpDeleteInterceptor(`articles/${id}`, headers);
// }
export async function deleteArticle(id: string) { export async function deleteArticle(id: string) {
const headers = { const headers = {
"content-type": "application/json", "content-type": "application/json",
Authorization: `Bearer ${token}`, Authorization: `Bearer ${token}`,
}; };
return await httpDeleteInterceptor(`articles/${id}`); return await httpPut(`articles/delete/${id}`, headers);
} }
export async function getArticleByCategory(timeStamp: number) { export async function getArticleByCategory(timeStamp: number) {
@ -169,11 +175,17 @@ export async function uploadArticleThumbnail(id: string, data: any) {
return await httpPost(`/articles/thumbnail/${id}`, headers, data); return await httpPost(`/articles/thumbnail/${id}`, headers, data);
} }
// export async function deleteArticleFiles(id: number) {
// const headers = {
// "content-type": "multipart/form-data",
// };
// return await httpDeleteInterceptor(`article-files/${id}`, headers);
// }
export async function deleteArticleFiles(id: number) { export async function deleteArticleFiles(id: number) {
const headers = { const headers = {
"content-type": "multipart/form-data", "content-type": "multipart/form-data",
}; };
return await httpDeleteInterceptor(`article-files/${id}`); return await httpPut(`article-files/delete/${id}`, headers);
} }
export async function getUserLevelDataStat( export async function getUserLevelDataStat(

View File

@ -32,11 +32,17 @@ export async function getCategoryById(id: number) {
return await httpGet(`/article-categories/${id}`, headers); return await httpGet(`/article-categories/${id}`, headers);
} }
// export async function deleteCategory(id: number) {
// const headers = {
// "content-type": "application/json",
// };
// return await httpDeleteInterceptor(`article-categories/${id}`, headers);
// }
export async function deleteCategory(id: number) { export async function deleteCategory(id: number) {
const headers = { const headers = {
"content-type": "application/json", "content-type": "application/json",
}; };
return await httpDeleteInterceptor(`article-categories/${id}`, headers); return await httpPut(`article-categories/delete/${id}`, headers);
} }
export async function uploadCategoryThumbnail(id: string, data: any) { export async function uploadCategoryThumbnail(id: string, data: any) {