fix : user id
deskripsi: - pemanggilan user id menggunakan API dan tidak lagi di server sid, pada bagian katalog dan ptofile
This commit is contained in:
@@ -1,12 +1,9 @@
|
|||||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
|
||||||
import { LayoutKatalogNew } from "@/app_modules/katalog/main";
|
import { LayoutKatalogNew } from "@/app_modules/katalog/main";
|
||||||
|
|
||||||
export default async function Layout({ children }: { children: any }) {
|
export default function Layout({ children }: { children: any }) {
|
||||||
const userLoginId = await funGetUserIdByToken();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LayoutKatalogNew userLoginId={userLoginId}>{children}</LayoutKatalogNew>
|
<LayoutKatalogNew>{children}</LayoutKatalogNew>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ViewKatalogNew } from "@/app_modules/katalog";
|
import { ViewKatalogNew } from "@/app_modules/katalog";
|
||||||
|
|
||||||
export default async function Page() {
|
export default function Page() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewKatalogNew />
|
<ViewKatalogNew />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { CreateProfile } from "@/app_modules/katalog/profile";
|
import { CreateProfile } from "@/app_modules/katalog/profile";
|
||||||
|
|
||||||
export default async function Page() {
|
export default function Page() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CreateProfile />
|
<CreateProfile />
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
import { EditProfileLayout } from "@/app_modules/katalog/profile";
|
import { EditProfileLayout } from "@/app_modules/katalog/profile";
|
||||||
|
|
||||||
export default async function Layout({
|
export default function Layout({ children }: { children: any }) {
|
||||||
children,
|
|
||||||
params,
|
|
||||||
}: {
|
|
||||||
children: any;
|
|
||||||
params: { id: string };
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<EditProfileLayout>{children}</EditProfileLayout>
|
<EditProfileLayout>{children}</EditProfileLayout>
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import EditProfile from "@/app_modules/katalog/profile/edit/view";
|
import EditProfile from "@/app_modules/katalog/profile/edit/view";
|
||||||
|
|
||||||
export default async function Page() {
|
export default function Page() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<EditProfile />
|
<EditProfile />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import LayoutProfile_UpdateFotoBackground from "@/app_modules/katalog/profile/upload/foto_background/layout";
|
import LayoutProfile_UpdateFotoBackground from "@/app_modules/katalog/profile/upload/foto_background/layout";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export default async function Layout({
|
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LayoutProfile_UpdateFotoBackground>
|
<LayoutProfile_UpdateFotoBackground>
|
||||||
|
|||||||
@@ -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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<Profile_UpdateFotoBackground />
|
<Profile_UpdateFotoBackground />
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import { UploadFotoProfileLayout } from "@/app_modules/katalog/profile";
|
import { UploadFotoProfileLayout } from "@/app_modules/katalog/profile";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export default async function Layout({
|
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UploadFotoProfileLayout>{children}</UploadFotoProfileLayout>
|
<UploadFotoProfileLayout>{children}</UploadFotoProfileLayout>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { UploadFotoProfile } from "@/app_modules/katalog/profile";
|
import { UploadFotoProfile } from "@/app_modules/katalog/profile";
|
||||||
|
|
||||||
export default async function Page() {
|
export default function Page() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UploadFotoProfile />
|
<UploadFotoProfile />
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { Component_Header } from "@/app_modules/_global/component/new/component_header";
|
import { Component_Header } from "@/app_modules/_global/component/new/component_header";
|
||||||
|
import { apiNewGetUserIdByToken } from "@/app_modules/_global/lib/api_fetch_global";
|
||||||
import UI_NewLayoutTamplate, {
|
import UI_NewLayoutTamplate, {
|
||||||
UI_NewChildren,
|
UI_NewChildren,
|
||||||
UI_NewHeader,
|
UI_NewHeader,
|
||||||
@@ -13,22 +14,23 @@ import { useParams } from "next/navigation";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import DrawerKatalogNew from "../component/drawer_katalog_new";
|
import DrawerKatalogNew from "../component/drawer_katalog_new";
|
||||||
|
|
||||||
export default function LayoutKatalogNew({
|
export default function LayoutKatalogNew({ children }: { children: any }) {
|
||||||
children,
|
|
||||||
userLoginId,
|
|
||||||
}: {
|
|
||||||
children: any;
|
|
||||||
userLoginId: string;
|
|
||||||
}) {
|
|
||||||
const param = useParams<{ id: string }>();
|
const param = useParams<{ id: string }>();
|
||||||
const [authorId, setAuthorId] = useState("");
|
const [authorId, setAuthorId] = useState("");
|
||||||
const [userRoleId, setUserRoleId] = useState("");
|
const [userRoleId, setUserRoleId] = useState("");
|
||||||
const [opened, { open, close }] = useDisclosure();
|
const [opened, { open, close }] = useDisclosure();
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [userLoginId, setUserLoginId] = useState("");
|
||||||
|
|
||||||
async function getProfile() {
|
async function handleLoadDataUser() {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
|
const reponseUser = await apiNewGetUserIdByToken();
|
||||||
|
if (reponseUser.success) {
|
||||||
|
setUserLoginId(reponseUser.userId);
|
||||||
|
}
|
||||||
|
|
||||||
const response = await apiGetUserProfile(`?profile=${param.id}`);
|
const response = await apiGetUserProfile(`?profile=${param.id}`);
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
@@ -43,38 +45,11 @@ export default function LayoutKatalogNew({
|
|||||||
}
|
}
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
getProfile();
|
handleLoadDataUser();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <UIGlobal_LayoutTamplate
|
|
||||||
header={
|
|
||||||
<UIGlobal_LayoutHeaderTamplate
|
|
||||||
title="KATALOG"
|
|
||||||
customButtonRight={
|
|
||||||
loading ? (
|
|
||||||
<ActionIcon disabled variant="transparent">
|
|
||||||
<CustomSkeleton h={20} w={20} radius={"100%"} />
|
|
||||||
</ActionIcon>
|
|
||||||
) : authorId == userLoginId ? (
|
|
||||||
<ActionIcon
|
|
||||||
c="white"
|
|
||||||
variant="transparent"
|
|
||||||
onClick={() => open()}
|
|
||||||
>
|
|
||||||
<IconDotsVertical />
|
|
||||||
</ActionIcon>
|
|
||||||
) : (
|
|
||||||
<ActionIcon disabled variant="transparent"></ActionIcon>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</UIGlobal_LayoutTamplate> */}
|
|
||||||
|
|
||||||
<UI_NewLayoutTamplate>
|
<UI_NewLayoutTamplate>
|
||||||
<UI_NewHeader>
|
<UI_NewHeader>
|
||||||
<Component_Header
|
<Component_Header
|
||||||
|
|||||||
Reference in New Issue
Block a user