From 718f1d9d8b346a4073e8327356827a1f96cffbae Mon Sep 17 00:00:00 2001 From: Rama Priyanto Date: Thu, 12 Jun 2025 21:59:50 +0700 Subject: [PATCH] fix:banner image, setting page , cookies set --- app/(admin)/settings/page.tsx | 10 ++++++---- components/form/login.tsx | 17 +++++++---------- components/landing/HeaderNews.tsx | 14 +++++++------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/(admin)/settings/page.tsx b/app/(admin)/settings/page.tsx index 69d900d..c16d1d3 100644 --- a/app/(admin)/settings/page.tsx +++ b/app/(admin)/settings/page.tsx @@ -11,12 +11,14 @@ export default function Settings() { const [profile, setProfile] = useState(); const uid = Cookies.get("uie"); useEffect(() => { - initFetch(); - }, []); + if (!profile) { + initFetch(); + } + }, [profile]); const initFetch = async () => { loading(); - const profile = await getDetailMasterUsers(String(uid)); - // const profile = await getProfile(); + // const profile = await getDetailMasterUsers(String(uid)); + const profile = await getProfile(); setProfile(profile?.data?.data); close(); }; diff --git a/components/form/login.tsx b/components/form/login.tsx index 92ab926..ac0abb9 100644 --- a/components/form/login.tsx +++ b/components/form/login.tsx @@ -255,21 +255,18 @@ export default function Login() { Cookies.set("username", profile?.username, { expires: 1, }); - Cookies.set("urie", profile?.roleId, { - expires: 1, - }); - Cookies.set("roleName", profile?.roleName, { - expires: 1, - }); - Cookies.set("masterPoldaId", profile?.masterPoldaId, { + Cookies.set("urie", profile?.userRoleId, { expires: 1, }); + // Cookies.set("masterPoldaId", profile?.masterPoldaId, { + // expires: 1, + // }); Cookies.set("ulne", profile?.userLevelId, { expires: 1, }); - Cookies.set("urce", profile?.roleCode, { - expires: 1, - }); + // Cookies.set("urce", profile?.data?.data?.roleCode, { + // expires: 1, + // }); Cookies.set("email", profile?.email, { expires: 1, }); diff --git a/components/landing/HeaderNews.tsx b/components/landing/HeaderNews.tsx index eb085df..e6d18cd 100644 --- a/components/landing/HeaderNews.tsx +++ b/components/landing/HeaderNews.tsx @@ -251,10 +251,10 @@ export default function HeaderNews() { {hotNews?.length > 0 ? ( headernews handleImageLoad(e, index)} src={ newsItem?.thumbnailUrl === "" @@ -296,7 +296,7 @@ export default function HeaderNews() { className={`!object-cover !rounded-none ${ portraitMap[index] ? "!w-auto object-cover mx-auto" - : "!w-[90vw]" + : "w-full" } !h-[500px]`} />