fix : user id
deskrispi: - menghapus async pada page atau layout dan menggunakan metode API dalam pemanggilan user id
This commit is contained in:
@@ -8,19 +8,11 @@ import UI_NewLayoutTamplate, {
|
||||
|
||||
export default function CreatePortofolioLayout({
|
||||
children,
|
||||
profileId,
|
||||
}: {
|
||||
children: any;
|
||||
profileId: any;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
{/* <UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Tambah Portofolio" />}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate> */}
|
||||
|
||||
<UI_NewLayoutTamplate>
|
||||
<UI_NewHeader>
|
||||
<Component_Header title="Tambah Portofolio" />
|
||||
|
||||
@@ -1,17 +1,38 @@
|
||||
'use client'
|
||||
"use client";
|
||||
import { Stack } from "@mantine/core";
|
||||
import Portofolio_UiDetailDataNew from "./ui_detail_data_new";
|
||||
import Portofolio_UiMapNew from "./ui_detail_map_new";
|
||||
import Portofolio_UiSosialMediaNew from "./ui_detail_media_new";
|
||||
import ComponentPortofolio_ButtonDeleteNew from "../component/button_delete_new";
|
||||
import { apiNewGetUserIdByToken } from "@/app_modules/_global/lib/api_fetch_global";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function Portofolio_UiDetailNew({
|
||||
mapboxToken,
|
||||
userLoginId,
|
||||
}: {
|
||||
mapboxToken: string;
|
||||
userLoginId: string
|
||||
}) {
|
||||
const [userLoginId, setUserLoginId] = useState("");
|
||||
|
||||
useShallowEffect(() => {
|
||||
onLoadDataUser();
|
||||
}, []);
|
||||
|
||||
async function onLoadDataUser() {
|
||||
try {
|
||||
const response = await apiNewGetUserIdByToken();
|
||||
if (response.success) {
|
||||
setUserLoginId(response.userId);
|
||||
} else {
|
||||
console.error("Error get user id", response.message);
|
||||
setUserLoginId("");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error get user id", error);
|
||||
setUserLoginId("");
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Stack mb={"lg"}>
|
||||
@@ -22,4 +43,4 @@ export default function Portofolio_UiDetailNew({
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,29 +5,38 @@ import UI_NewLayoutTamplate, {
|
||||
UI_NewHeader,
|
||||
} from "@/app_modules/_global/ui/V2_layout_tamplate";
|
||||
import ComponentPortofolio_ButtonMoreNew from "../component/button_more_new";
|
||||
import { useState } from "react";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { apiNewGetUserIdByToken } from "@/app_modules/_global/lib/api_fetch_global";
|
||||
|
||||
export default function PortofolioLayoutNew({
|
||||
children,
|
||||
userLoginId,
|
||||
}: {
|
||||
children: any;
|
||||
userLoginId: string;
|
||||
}) {
|
||||
const [userLoginId, setUserLoginId] = useState("");
|
||||
|
||||
useShallowEffect(() => {
|
||||
onLoadDataUser();
|
||||
}, []);
|
||||
|
||||
async function onLoadDataUser() {
|
||||
try {
|
||||
const response = await apiNewGetUserIdByToken();
|
||||
if (response.success) {
|
||||
setUserLoginId(response.userId);
|
||||
} else {
|
||||
console.error("Error get user id", response.message);
|
||||
setUserLoginId("");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error get user id", error);
|
||||
setUserLoginId("");
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title="Detail Portofolio"
|
||||
customButtonRight={
|
||||
<ComponentPortofolio_ButtonMoreNew userLoginId={userLoginId} />
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate> */}
|
||||
|
||||
<UI_NewLayoutTamplate>
|
||||
<UI_NewHeader>
|
||||
<Component_Header
|
||||
|
||||
Reference in New Issue
Block a user