diff --git a/app/detail/page.tsx b/app/detail/page.tsx deleted file mode 100644 index 4b74f2d..0000000 --- a/app/detail/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react' - -export default function Page() { - return ( -
page
- ) -} diff --git a/components/form/login.tsx b/components/form/login.tsx index e98bb13..c4caf27 100644 --- a/components/form/login.tsx +++ b/components/form/login.tsx @@ -12,6 +12,8 @@ import { otpRequest, otpValidation, postSignIn, + savePassword, + updateProfile, } from "@/service/master-user"; import { useRouter } from "next/navigation"; import Swal from "sweetalert2"; @@ -56,82 +58,82 @@ export default function Login() { setAccessData(response?.data?.data); const profile = await getProfile(response?.data?.data?.access_token); console.log("PROFILE : ", profile?.data?.data); - // setEmailSetup(profile?.data?.data?.email); - // setProfile(profile?.data?.data); - // setFirstLogin(true); + setEmailSetup(profile?.data?.data?.email); + setProfile(profile?.data?.data); + setFirstLogin(true); - // if (profile?.data?.data?.isFirstLogin) { - // setFirstLogin(true); - // } else { - // const res = await otpRequest( - // profile?.data?.data?.email, - // profile?.data?.data?.fullname - // ); - // setNeedOtp(true); - // } + if (profile?.data?.data?.isFirstLogin) { + setFirstLogin(true); + } else { + const res = await otpRequest( + profile?.data?.data?.email, + profile?.data?.data?.fullname + ); + setNeedOtp(true); + } - 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, { - expires: 1, - }); - Cookies.set("refresh_token", response?.data?.data?.refresh_token, { - expires: 1, - }); - Cookies.set("time_refresh", newTime, { - expires: 1, - }); - Cookies.set("is_first_login", "true", { - secure: true, - sameSite: "strict", - }); - const resActivity = await saveActivity( - { - activityTypeId: 1, - url: "https://kontenhumas.com/auth", - userId: profile?.data?.data?.id, - }, - accessData?.id_token - ); - Cookies.set("profile_picture", profile?.data?.data?.profilePictureUrl, { - expires: 1, - }); - Cookies.set("uie", profile?.data?.data?.id, { - expires: 1, - }); - Cookies.set("ufne", profile?.data?.data?.fullname, { - expires: 1, - }); - Cookies.set("ulie", profile?.data?.data?.userLevelGroup, { - expires: 1, - }); - Cookies.set("username", profile?.data?.data?.username, { - expires: 1, - }); - Cookies.set("urie", profile?.data?.data?.roleId, { - expires: 1, - }); - Cookies.set("roleName", profile?.data?.data?.roleName, { - expires: 1, - }); - Cookies.set("masterPoldaId", profile?.data?.data?.masterPoldaId, { - expires: 1, - }); - Cookies.set("ulne", profile?.data?.data?.userLevelId, { - expires: 1, - }); - Cookies.set("urce", profile?.data?.data?.roleCode, { - expires: 1, - }); - Cookies.set("email", profile?.data?.data?.email, { - expires: 1, - }); - router.push("/admin/dashboard"); - Cookies.set("status", "login", { - expires: 1, - }); + // Cookies.set("access_token", response?.data?.data?.access_token, { + // expires: 1, + // }); + // Cookies.set("refresh_token", response?.data?.data?.refresh_token, { + // expires: 1, + // }); + // Cookies.set("time_refresh", newTime, { + // expires: 1, + // }); + // Cookies.set("is_first_login", "true", { + // secure: true, + // sameSite: "strict", + // }); + // const resActivity = await saveActivity( + // { + // activityTypeId: 1, + // url: "https://kontenhumas.com/auth", + // userId: profile?.data?.data?.id, + // }, + // accessData?.id_token + // ); + // Cookies.set("profile_picture", profile?.data?.data?.profilePictureUrl, { + // expires: 1, + // }); + // Cookies.set("uie", profile?.data?.data?.id, { + // expires: 1, + // }); + // Cookies.set("ufne", profile?.data?.data?.fullname, { + // expires: 1, + // }); + // Cookies.set("ulie", profile?.data?.data?.userLevelGroup, { + // expires: 1, + // }); + // Cookies.set("username", profile?.data?.data?.username, { + // expires: 1, + // }); + // Cookies.set("urie", profile?.data?.data?.roleId, { + // expires: 1, + // }); + // Cookies.set("roleName", profile?.data?.data?.roleName, { + // expires: 1, + // }); + // Cookies.set("masterPoldaId", profile?.data?.data?.masterPoldaId, { + // expires: 1, + // }); + // Cookies.set("ulne", profile?.data?.data?.userLevelId, { + // expires: 1, + // }); + // Cookies.set("urce", profile?.data?.data?.roleCode, { + // expires: 1, + // }); + // Cookies.set("email", profile?.data?.data?.email, { + // expires: 1, + // }); + // router.push("/admin/dashboard"); + // Cookies.set("status", "login", { + // expires: 1, + // }); close(); } @@ -251,51 +253,28 @@ export default function Login() { close(); }; - const generatePassword = () => { - const length = Math.floor(Math.random() * 9) + 8; + const submitResetEmail = async () => { + const req = { + email: emailSetup, + fullName: profile?.fullname, + username: profile?.username, + userLevelId: profile?.userLevelId, + userRoleId: profile?.userRoleId, + }; - const upperCaseChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - const lowerCaseChars = "abcdefghijklmnopqrstuvwxyz"; - const numberChars = "0123456789"; - const specialChars = "!@#$%^&*"; - const allChars = - upperCaseChars + lowerCaseChars + numberChars + specialChars; - - let generatedPassword = ""; - - generatedPassword += - upperCaseChars[Math.floor(Math.random() * upperCaseChars.length)]; - generatedPassword += - specialChars[Math.floor(Math.random() * specialChars.length)]; - generatedPassword += - numberChars[Math.floor(Math.random() * numberChars.length)]; - generatedPassword += - lowerCaseChars[Math.floor(Math.random() * lowerCaseChars.length)]; - - for (let i = generatedPassword.length; i < length; i++) { - generatedPassword += - allChars[Math.floor(Math.random() * allChars.length)]; + const res = await updateProfile(req); + if (res?.error) { + error(res.message); + return false; } + close(); - generatedPassword = generatedPassword - .split("") - .sort(() => 0.5 - Math.random()) - .join(""); - - setPasswordSetup(generatedPassword); + console.log("profile", req, passwordSetup, confPasswordSetup); }; return (
-
+
login-image
@@ -327,85 +306,11 @@ export default function Login() { value={emailSetup} onValueChange={setEmailSetup} /> -

Password Baru

- - setIsVisibleSetup([!isVisibleSetup[0], isVisibleSetup[1]]) - } - > - {isVisibleSetup[0] ? ( - - ) : ( - - )} - - } - type={isVisibleSetup[0] ? "text" : "password"} - label="" - placeholder="" - value={passwordSetup} - onValueChange={setPasswordSetup} - /> -

Konfirmasi Password Baru

- - setIsVisibleSetup([isVisibleSetup[0], !isVisibleSetup[1]]) - } - > - {isVisibleSetup[1] ? ( - - ) : ( - - )} - - } - type={isVisibleSetup[1] ? "text" : "password"} - label="" - placeholder="" - value={confPasswordSetup} - onValueChange={setConfPasswordSetup} - /> - - Generate Password - - { - setIsValidPassword(isValid); - }} - className="text-white text-sm my-3" - messages={{ - minLength: "Kata sandi harus lebih dari 8 karakter", - specialChar: "Kata sandi harus mengandung karakter khusus", - number: "Kata sandi harus mengandung angka", - capital: "Kata sandi harus mengandung huruf kapital", - match: "Kata sandi cocok", - }} - /> + Validasi Email diff --git a/components/landing/HeaderNews.tsx b/components/landing/HeaderNews.tsx index 2b1a3c1..e0a345f 100644 --- a/components/landing/HeaderNews.tsx +++ b/components/landing/HeaderNews.tsx @@ -67,7 +67,7 @@ export default function HeaderNews() { return (
-
+
{article ? ( @@ -138,11 +138,11 @@ export default function HeaderNews() { )}
-
+

{t("berita")}

- + {hotNews?.map((data: any, index: number) => (
-
+
{article ? ( {article?.map((newsItem: any, index: number) => ( - + headernews @@ -273,11 +273,11 @@ export default function HeaderNews() { )}
-
+ diff --git a/components/landing/digital-services.tsx b/components/landing/digital-services.tsx index 6e93ebf..bd57e4e 100644 --- a/components/landing/digital-services.tsx +++ b/components/landing/digital-services.tsx @@ -20,10 +20,10 @@ export default function DigitalServices() { Polda Satker dan Layanan Digital

-
+
setIsPoldaOpen(true)} - className="group shadow-lg rounded-lg w-full lg:w-[200px] h-[200px] flex flex-col justify-center items-center hover:border-3 hover:border-red-600 cursor-pointer mx-auto transition duration-300 ease-in-out" + className="group shadow-lg rounded-lg w-full h-[200px] flex flex-col justify-center items-center hover:border-3 hover:border-red-600 cursor-pointer mx-auto transition duration-300 ease-in-out" > setIsSatkerOpen(true)} - className="group shadow-lg rounded-lg w-full lg:w-[200px] h-[200px] flex flex-col justify-center items-center hover:border-3 hover:border-red-600 cursor-pointer mx-auto transition duration-300 ease-in-out" + className="group shadow-lg rounded-lg w-full h-[200px] flex flex-col justify-center items-center hover:border-3 hover:border-red-600 cursor-pointer mx-auto transition duration-300 ease-in-out" > setIsAppsOpen(true)} - className="group shadow-lg rounded-lg w-full lg:w-[200px] h-[200px] flex flex-col justify-center items-center hover:border-3 hover:border-red-600 cursor-pointer mx-auto transition duration-300 ease-in-out" + className="group shadow-lg rounded-lg w-full h-[200px] flex flex-col justify-center items-center hover:border-3 hover:border-red-600 cursor-pointer mx-auto transition duration-300 ease-in-out" > setIsSuggestionOpen(true)} - className="group shadow-lg rounded-lg w-full lg:w-[200px] h-[200px] flex flex-col justify-center items-center hover:border-3 hover:border-red-600 cursor-pointer mx-auto transition duration-300 ease-in-out" + className="group shadow-lg rounded-lg w-full h-[200px] flex flex-col justify-center items-center hover:border-3 hover:border-red-600 cursor-pointer mx-auto transition duration-300 ease-in-out" >
-
+

Tentang Kami

@@ -123,7 +123,7 @@ export default function FooterNew(props: { margin?: boolean }) {
-
+

Download Aplikasi Polri Presisi

@@ -133,7 +133,7 @@ export default function FooterNew(props: { margin?: boolean }) { className="flex flex-row p-1 border-1 border-black dark:border-white rounded-lg items-center" > -
@@ -1331,14 +1331,14 @@ export default function NavbarHumas(props: { size: string }) { />
- language === "id" ? setLanguage("en") : setLanguage("id") } > {language === "id" ? : } - + */} diff --git a/components/main/detail/new-detail.tsx b/components/main/detail/new-detail.tsx index 222227c..bbbd922 100644 --- a/components/main/detail/new-detail.tsx +++ b/components/main/detail/new-detail.tsx @@ -34,19 +34,10 @@ export default function NewsDetailPage(props: { datas: any }) { const response = await getListArticle(req); setArticles(response?.data?.data); } - - const initFetch = async () => { - loading(); - const res = await getArticleById(id?.split("-")[0]); - const data = res?.data?.data; - setDetailArticle(data); - close(); - }; - const sendActivity = async () => { let req: any = { activityTypeId: 2, - url: "https://kontenhumas.com/" + pathname, + url: "https://kontenhumas.com" + pathname, articleId: Number(id?.split("-")[0]), }; if (uid) { @@ -55,24 +46,9 @@ export default function NewsDetailPage(props: { datas: any }) { const resActivity = await saveActivity(req, token); }; + return ( <> - {/* {" "} - - {detailArticle?.title} - - - - - - - - - - */}