feat:delete change (httpdelete to put)
This commit is contained in:
parent
ca0b40663a
commit
a1baedde47
|
|
@ -195,7 +195,12 @@ export default function FormMasterUser() {
|
||||||
|
|
||||||
const fetchUserLevel = async () => {
|
const fetchUserLevel = async () => {
|
||||||
loading();
|
loading();
|
||||||
const res = await getAllUserLevels();
|
const request = {
|
||||||
|
limit: 1000,
|
||||||
|
page: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = await getAllUserLevels(request);
|
||||||
close();
|
close();
|
||||||
if (res?.data?.data) {
|
if (res?.data?.data) {
|
||||||
setupParent(res?.data?.data, "level");
|
setupParent(res?.data?.data, "level");
|
||||||
|
|
|
||||||
|
|
@ -69,101 +69,101 @@ export default function Login() {
|
||||||
error("Username & Password Wajib Diisi !");
|
error("Username & Password Wajib Diisi !");
|
||||||
} else {
|
} else {
|
||||||
// login dengan otp
|
// login dengan otp
|
||||||
loading();
|
// loading();
|
||||||
const response: any = await emailValidation(data);
|
// const response: any = await emailValidation(data);
|
||||||
if (response?.error) {
|
// if (response?.error) {
|
||||||
console.log("error", response);
|
// console.log("error", response);
|
||||||
if (response?.message?.messages[0]?.includes("failed to send mail")) {
|
// if (response?.message?.messages[0]?.includes("failed to send mail")) {
|
||||||
error("Gagal Mengirim OTP");
|
// error("Gagal Mengirim OTP");
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (response?.message?.messages[0]?.includes("username")) {
|
// if (response?.message?.messages[0]?.includes("username")) {
|
||||||
error("Username / Password Tidak Sesuai");
|
// error("Username / Password Tidak Sesuai");
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
error("Unknown Error");
|
// error("Unknown Error");
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
close();
|
// close();
|
||||||
if (response?.data?.messages[0] === "Continue to setup email") {
|
// if (response?.data?.messages[0] === "Continue to setup email") {
|
||||||
setFirstLogin(true);
|
// setFirstLogin(true);
|
||||||
} else {
|
// } else {
|
||||||
setNeedOtp(true);
|
// setNeedOtp(true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// login tanpa otp
|
// login tanpa otp
|
||||||
// loading();
|
loading();
|
||||||
// const response = await postSignIn(data);
|
const response = await postSignIn(data);
|
||||||
// if (response?.error) {
|
if (response?.error) {
|
||||||
// error("Username / Password Tidak Sesuai");
|
error("Username / Password Tidak Sesuai");
|
||||||
// } else {
|
} else {
|
||||||
// const profile = await getProfile(response?.data?.data?.access_token);
|
const profile = await getProfile(response?.data?.data?.access_token);
|
||||||
// const dateTime: any = new Date();
|
const dateTime: any = new Date();
|
||||||
|
|
||||||
// const newTime: any = dateTime.getTime() + 10 * 60 * 1000;
|
const newTime: any = dateTime.getTime() + 10 * 60 * 1000;
|
||||||
|
|
||||||
// Cookies.set("access_token", response?.data?.data?.access_token, {
|
Cookies.set("access_token", response?.data?.data?.access_token, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("refresh_token", response?.data?.data?.refresh_token, {
|
Cookies.set("refresh_token", response?.data?.data?.refresh_token, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("time_refresh", newTime, {
|
Cookies.set("time_refresh", newTime, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("is_first_login", "true", {
|
Cookies.set("is_first_login", "true", {
|
||||||
// secure: true,
|
secure: true,
|
||||||
// sameSite: "strict",
|
sameSite: "strict",
|
||||||
// });
|
});
|
||||||
// const resActivity = await saveActivity(
|
const resActivity = await saveActivity(
|
||||||
// {
|
{
|
||||||
// activityTypeId: 1,
|
activityTypeId: 1,
|
||||||
// url: "https://kontenhumas.com/auth",
|
url: "https://kontenhumas.com/auth",
|
||||||
// userId: profile?.data?.data?.id,
|
userId: profile?.data?.data?.id,
|
||||||
// },
|
},
|
||||||
// accessData?.id_token
|
accessData?.id_token
|
||||||
// );
|
);
|
||||||
// Cookies.set("profile_picture", profile?.data?.data?.profilePictureUrl, {
|
Cookies.set("profile_picture", profile?.data?.data?.profilePictureUrl, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("uie", profile?.data?.data?.id, {
|
Cookies.set("uie", profile?.data?.data?.id, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("ufne", profile?.data?.data?.fullname, {
|
Cookies.set("ufne", profile?.data?.data?.fullname, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("ulie", profile?.data?.data?.userLevelGroup, {
|
Cookies.set("ulie", profile?.data?.data?.userLevelGroup, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("username", profile?.data?.data?.username, {
|
Cookies.set("username", profile?.data?.data?.username, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("urie", profile?.data?.data?.roleId, {
|
Cookies.set("urie", profile?.data?.data?.roleId, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("roleName", profile?.data?.data?.roleName, {
|
Cookies.set("roleName", profile?.data?.data?.roleName, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("masterPoldaId", profile?.data?.data?.masterPoldaId, {
|
Cookies.set("masterPoldaId", profile?.data?.data?.masterPoldaId, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("ulne", profile?.data?.data?.userLevelId, {
|
Cookies.set("ulne", profile?.data?.data?.userLevelId, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("urce", profile?.data?.data?.roleCode, {
|
Cookies.set("urce", profile?.data?.data?.roleCode, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// Cookies.set("email", profile?.data?.data?.email, {
|
Cookies.set("email", profile?.data?.data?.email, {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
// router.push("/admin/dashboard");
|
router.push("/admin/dashboard");
|
||||||
// Cookies.set("status", "login", {
|
Cookies.set("status", "login", {
|
||||||
// expires: 1,
|
expires: 1,
|
||||||
// });
|
});
|
||||||
|
|
||||||
// close();
|
close();
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ export default function HeaderNews() {
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex flex-col lg:flex-row gap-3 lg:gap-8 bg-white dark:bg-black p-1 lg:p-8 lg:h-[540px] w-full lg:w-[75%] lg:mx-auto">
|
<div className="flex flex-col lg:flex-row gap-3 lg:gap-8 bg-white dark:bg-black p-1 lg:p-8 lg:h-[540px] w-full lg:w-[75%] lg:mx-auto">
|
||||||
<div className="lg:hidden w-[90%] h-[300px] md:h-[500px] mx-auto">
|
<div className="lg:hidden w-[90%] h-[300px] md:h-[500px] mx-auto">
|
||||||
{banner.length > 0 ? (
|
{hotNews?.length > 0 ? (
|
||||||
<Swiper
|
<Swiper
|
||||||
centeredSlides={true}
|
centeredSlides={true}
|
||||||
autoplay={{
|
autoplay={{
|
||||||
|
|
@ -110,7 +110,7 @@ export default function HeaderNews() {
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{banner?.map((newsItem: any, index: number) => (
|
{hotNews?.map((newsItem: any, index: number) => (
|
||||||
<SwiperSlide key={newsItem?.id}>
|
<SwiperSlide key={newsItem?.id}>
|
||||||
<Card
|
<Card
|
||||||
radius="lg"
|
radius="lg"
|
||||||
|
|
@ -162,8 +162,8 @@ export default function HeaderNews() {
|
||||||
Hot Topik
|
Hot Topik
|
||||||
</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}
|
||||||
|
|
@ -225,7 +225,7 @@ export default function HeaderNews() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="hidden lg:block w-full lg:w-[50%] h-[500px]">
|
<div className="hidden lg:block w-full lg:w-[50%] h-[500px]">
|
||||||
{banner.length > 0 ? (
|
{hotNews?.length > 0 ? (
|
||||||
<Swiper
|
<Swiper
|
||||||
centeredSlides={true}
|
centeredSlides={true}
|
||||||
autoplay={{
|
autoplay={{
|
||||||
|
|
@ -252,7 +252,7 @@ export default function HeaderNews() {
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{banner.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
|
||||||
|
|
@ -268,7 +268,7 @@ export default function HeaderNews() {
|
||||||
? "/no-image.jpg"
|
? "/no-image.jpg"
|
||||||
: newsItem?.thumbnailUrl
|
: newsItem?.thumbnailUrl
|
||||||
}
|
}
|
||||||
className="!w-full !h-[500px] !object-cover !rounded-none"
|
className="!w-[90vw] !h-[500px] !object-cover !rounded-none"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CardFooter className="mb-1 max-h-[20vh] before:bg-white/10 border-white/20 border-1 overflow-hidden py-1 md:absolute before:rounded-xl rounded-large bottom-1 w-[calc(100%_-_8px)] shadow-small ml-1 z-10">
|
<CardFooter className="mb-1 max-h-[20vh] before:bg-white/10 border-white/20 border-1 overflow-hidden py-1 md:absolute before:rounded-xl rounded-large bottom-1 w-[calc(100%_-_8px)] shadow-small ml-1 z-10">
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,7 @@ export default function ArticleTable() {
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
success("Berhasil Hapus");
|
success("Berhasil Hapus");
|
||||||
|
setPage(1);
|
||||||
initState();
|
initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,8 @@ export default function MasterUserLevelTable() {
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
setMasterUserLevel(newData);
|
setMasterUserLevel(newData);
|
||||||
|
} else {
|
||||||
|
setMasterUserLevel([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -329,6 +331,8 @@ export default function MasterUserLevelTable() {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{masterUserLevelTable && (
|
||||||
|
<>
|
||||||
<Table
|
<Table
|
||||||
// selectionMode="multiple"
|
// selectionMode="multiple"
|
||||||
aria-label="micro issue table"
|
aria-label="micro issue table"
|
||||||
|
|
@ -386,6 +390,8 @@ export default function MasterUserLevelTable() {
|
||||||
onChange={(page) => setPage(page)}
|
onChange={(page) => setPage(page)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,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, headers);
|
return await httpPut(pathUrl, headers);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,11 +126,17 @@ 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",
|
||||||
};
|
};
|
||||||
return await httpDeleteInterceptor(`articles/${id}`, headers);
|
return await httpPut(`articles/delete/${id}`, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getArticleByCategory() {
|
export async function getArticleByCategory() {
|
||||||
|
|
@ -165,11 +171,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}`, headers);
|
return await httpPut(`article-files/delete/${id}`, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getUserLevelDataStat(startDate: string, endDate: string) {
|
export async function getUserLevelDataStat(startDate: string, endDate: string) {
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue