diff --git a/src/app/dev/(user)/katalog/[id]/layout.tsx b/src/app/dev/(user)/katalog/[id]/layout.tsx index 79911004..9e9bf3e5 100644 --- a/src/app/dev/(user)/katalog/[id]/layout.tsx +++ b/src/app/dev/(user)/katalog/[id]/layout.tsx @@ -1,12 +1,9 @@ -import { funGetUserIdByToken } from "@/app_modules/_global/fun/get"; import { LayoutKatalogNew } from "@/app_modules/katalog/main"; -export default async function Layout({ children }: { children: any }) { - const userLoginId = await funGetUserIdByToken(); - +export default function Layout({ children }: { children: any }) { return ( <> - {children} + {children} ); } diff --git a/src/app/dev/(user)/katalog/[id]/page.tsx b/src/app/dev/(user)/katalog/[id]/page.tsx index 997d4b80..949476ce 100644 --- a/src/app/dev/(user)/katalog/[id]/page.tsx +++ b/src/app/dev/(user)/katalog/[id]/page.tsx @@ -1,6 +1,6 @@ import { ViewKatalogNew } from "@/app_modules/katalog"; -export default async function Page() { +export default function Page() { return ( <> diff --git a/src/app/dev/(user)/profile/create/page.tsx b/src/app/dev/(user)/profile/create/page.tsx index 26cf870f..ef90717f 100644 --- a/src/app/dev/(user)/profile/create/page.tsx +++ b/src/app/dev/(user)/profile/create/page.tsx @@ -1,6 +1,6 @@ import { CreateProfile } from "@/app_modules/katalog/profile"; -export default async function Page() { +export default function Page() { return ( <> diff --git a/src/app/dev/(user)/profile/edit/[id]/layout.tsx b/src/app/dev/(user)/profile/edit/[id]/layout.tsx index dfe00c95..9b8d49f1 100644 --- a/src/app/dev/(user)/profile/edit/[id]/layout.tsx +++ b/src/app/dev/(user)/profile/edit/[id]/layout.tsx @@ -1,12 +1,6 @@ import { EditProfileLayout } from "@/app_modules/katalog/profile"; -export default async function Layout({ - children, - params, -}: { - children: any; - params: { id: string }; -}) { +export default function Layout({ children }: { children: any }) { return ( <> {children} diff --git a/src/app/dev/(user)/profile/edit/[id]/page.tsx b/src/app/dev/(user)/profile/edit/[id]/page.tsx index b1ec31b1..bbd2c348 100644 --- a/src/app/dev/(user)/profile/edit/[id]/page.tsx +++ b/src/app/dev/(user)/profile/edit/[id]/page.tsx @@ -1,10 +1,9 @@ import EditProfile from "@/app_modules/katalog/profile/edit/view"; -export default async function Page() { - +export default function Page() { return ( <> - + ); } diff --git a/src/app/dev/(user)/profile/upload/background/[id]/layout.tsx b/src/app/dev/(user)/profile/upload/background/[id]/layout.tsx index 11f4cf1b..0a75f4af 100644 --- a/src/app/dev/(user)/profile/upload/background/[id]/layout.tsx +++ b/src/app/dev/(user)/profile/upload/background/[id]/layout.tsx @@ -1,11 +1,7 @@ import LayoutProfile_UpdateFotoBackground from "@/app_modules/katalog/profile/upload/foto_background/layout"; import React from "react"; -export default async function Layout({ - children, -}: { - children: React.ReactNode; -}) { +export default function Layout({ children }: { children: React.ReactNode }) { return ( <> diff --git a/src/app/dev/(user)/profile/upload/background/[id]/page.tsx b/src/app/dev/(user)/profile/upload/background/[id]/page.tsx index 35367183..30dd9aa9 100644 --- a/src/app/dev/(user)/profile/upload/background/[id]/page.tsx +++ b/src/app/dev/(user)/profile/upload/background/[id]/page.tsx @@ -1,6 +1,6 @@ -import Profile_UpdateFotoBackground from "@/app_modules/katalog/profile/upload/foto_background" +import Profile_UpdateFotoBackground from "@/app_modules/katalog/profile/upload/foto_background"; -export default async function Page() { +export default function Page() { return ( <> diff --git a/src/app/dev/(user)/profile/upload/foto/[id]/layout.tsx b/src/app/dev/(user)/profile/upload/foto/[id]/layout.tsx index 5613eabd..a10335a4 100644 --- a/src/app/dev/(user)/profile/upload/foto/[id]/layout.tsx +++ b/src/app/dev/(user)/profile/upload/foto/[id]/layout.tsx @@ -1,11 +1,7 @@ import { UploadFotoProfileLayout } from "@/app_modules/katalog/profile"; import React from "react"; -export default async function Layout({ - children, -}: { - children: React.ReactNode; -}) { +export default function Layout({ children }: { children: React.ReactNode }) { return ( <> {children} diff --git a/src/app/dev/(user)/profile/upload/foto/[id]/page.tsx b/src/app/dev/(user)/profile/upload/foto/[id]/page.tsx index 66ced2af..da130aac 100644 --- a/src/app/dev/(user)/profile/upload/foto/[id]/page.tsx +++ b/src/app/dev/(user)/profile/upload/foto/[id]/page.tsx @@ -1,6 +1,6 @@ import { UploadFotoProfile } from "@/app_modules/katalog/profile"; -export default async function Page() { +export default function Page() { return ( <> diff --git a/src/app_modules/katalog/main/layout_new.tsx b/src/app_modules/katalog/main/layout_new.tsx index c273d834..a21833fa 100644 --- a/src/app_modules/katalog/main/layout_new.tsx +++ b/src/app_modules/katalog/main/layout_new.tsx @@ -1,5 +1,6 @@ "use client"; import { Component_Header } from "@/app_modules/_global/component/new/component_header"; +import { apiNewGetUserIdByToken } from "@/app_modules/_global/lib/api_fetch_global"; import UI_NewLayoutTamplate, { UI_NewChildren, UI_NewHeader, @@ -13,22 +14,23 @@ import { useParams } from "next/navigation"; import { useState } from "react"; import DrawerKatalogNew from "../component/drawer_katalog_new"; -export default function LayoutKatalogNew({ - children, - userLoginId, -}: { - children: any; - userLoginId: string; -}) { +export default function LayoutKatalogNew({ children }: { children: any }) { const param = useParams<{ id: string }>(); const [authorId, setAuthorId] = useState(""); const [userRoleId, setUserRoleId] = useState(""); const [opened, { open, close }] = useDisclosure(); const [loading, setLoading] = useState(true); + const [userLoginId, setUserLoginId] = useState(""); - async function getProfile() { + async function handleLoadDataUser() { try { setLoading(true); + + const reponseUser = await apiNewGetUserIdByToken(); + if (reponseUser.success) { + setUserLoginId(reponseUser.userId); + } + const response = await apiGetUserProfile(`?profile=${param.id}`); if (response) { @@ -43,38 +45,11 @@ export default function LayoutKatalogNew({ } useShallowEffect(() => { - getProfile(); + handleLoadDataUser(); }, []); return ( <> - {/* - - - ) : authorId == userLoginId ? ( - open()} - > - - - ) : ( - - ) - } - /> - } - > - {children} - */} -