fix
Desc: - Perubahan minor
This commit is contained in:
BIN
public/img/3db9b189-72dd-4a9c-947c-1833f18695c0.png
Normal file
BIN
public/img/3db9b189-72dd-4a9c-947c-1833f18695c0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
@@ -17,7 +17,6 @@ export async function POST(req: Request) {
|
|||||||
masterBidangBisnisId: body.masterBidangBisnisId,
|
masterBidangBisnisId: body.masterBidangBisnisId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(data)
|
|
||||||
|
|
||||||
return NextResponse.json({ status: 201, success: true });
|
return NextResponse.json({ status: 201, success: true });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { NextResponse } from "next/server";
|
|||||||
export async function POST(req: Request) {
|
export async function POST(req: Request) {
|
||||||
if (req.method === "POST") {
|
if (req.method === "POST") {
|
||||||
const body = await req.json();
|
const body = await req.json();
|
||||||
myConsole(body);
|
// myConsole(body);
|
||||||
|
|
||||||
const data = await prisma.profile.create({
|
const data = await prisma.profile.create({
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@@ -1,11 +1,22 @@
|
|||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import fs from 'fs'
|
import fs from "fs";
|
||||||
|
|
||||||
export async function GET(req: NextRequest, { params }: { params: { name: string } }) {
|
export async function GET(
|
||||||
const fl = fs.readFileSync(`./public/img/${params.name}`)
|
req: NextRequest,
|
||||||
|
{ params }: { params: { name: string } }
|
||||||
|
) {
|
||||||
|
if (!fs.existsSync(`./public/img/${params.name}`)) {
|
||||||
|
const fl = fs.readFileSync(`./public/aset/avatar.png`);
|
||||||
return new NextResponse(fl, {
|
return new NextResponse(fl, {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "image/png"
|
"Content-Type": "image/png",
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
const fl = fs.readFileSync(`./public/img/${params.name}`);
|
||||||
|
return new NextResponse(fl, {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "image/png",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,8 +35,11 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { gs_token } from "./state/global_state";
|
import { gs_token } from "./state/global_state";
|
||||||
import { loadDataProfile } from "../katalog/profile/fun/fun_get_profile";
|
import { loadDataProfile } from "../katalog/profile/fun/fun_get_profile";
|
||||||
import { gs_profile } from "../katalog/profile/state/global_state";
|
import { gs_fotoProfile, gs_profile } from "../katalog/profile/state/global_state";
|
||||||
import { loadListPortofolio } from "../katalog/portofolio/fun/fun_get_all_portofolio";
|
import { loadListPortofolio } from "../katalog/portofolio/fun/fun_get_all_portofolio";
|
||||||
|
import { gs_ListPortofolio } from "../katalog/portofolio/state/global_state";
|
||||||
|
import { myConsole } from "@/app/fun/my_console";
|
||||||
|
import { getFotoProfile } from "../katalog/profile/api/get-foto-profile";
|
||||||
|
|
||||||
const listHalaman = [
|
const listHalaman = [
|
||||||
{
|
{
|
||||||
@@ -99,10 +102,19 @@ export default function HomeView() {
|
|||||||
loadDataProfile(setProfile);
|
loadDataProfile(setProfile);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// const [listPorto, setListPorto] = useState<any | null>(null);
|
const [foto, setFoto] = useAtom(gs_fotoProfile);
|
||||||
// useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
// loadListPortofolio(profile?.id).then((res) => setListPorto(res));
|
if (profile?.imagesId === undefined) {
|
||||||
// }, [profile?.id]);
|
return myConsole("Waiting data");
|
||||||
|
} else {
|
||||||
|
getFotoProfile(profile?.imagesId).then((v) => setFoto(v?.url));
|
||||||
|
}
|
||||||
|
}, [profile?.imagesId]);
|
||||||
|
|
||||||
|
const [listPorto, setListPorto] = useAtom(gs_ListPortofolio)
|
||||||
|
useShallowEffect(() => {
|
||||||
|
loadListPortofolio(profile?.id).then((res) => setListPorto(res));
|
||||||
|
}, [profile?.id]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default function EditProfile({ data }: { data: any }) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
//Get data profile
|
//Get data profile
|
||||||
const [profile, setProfile] = useState(data)
|
const [profile, setProfile] = useAtom(gs_profile)
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
loadDataProfile(setProfile);
|
loadDataProfile(setProfile);
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ import { atomWithStorage } from "jotai/utils";
|
|||||||
import { getProfile } from "..";
|
import { getProfile } from "..";
|
||||||
|
|
||||||
export const gs_profile = atomWithStorage<any | null>("gs_profile", null);
|
export const gs_profile = atomWithStorage<any | null>("gs_profile", null);
|
||||||
|
export const gs_fotoProfile = atomWithStorage<any | null>("gs_fotoProfile" , null)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { AspectRatio, FileButton, Image, Paper, Title } from "@mantine/core";
|
|||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { loadDataProfile } from "../fun/fun_get_profile";
|
import { loadDataProfile } from "../fun/fun_get_profile";
|
||||||
import { gs_profile } from "../state/global_state";
|
import { gs_fotoProfile, gs_profile } from "../state/global_state";
|
||||||
import { getFotoProfile } from "../api/get-foto-profile";
|
import { getFotoProfile } from "../api/get-foto-profile";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ApiHipmi } from "@/app/lib/api";
|
import { ApiHipmi } from "@/app/lib/api";
|
||||||
@@ -16,7 +16,7 @@ export default function UploadFotoProfile() {
|
|||||||
loadDataProfile(setProfile);
|
loadDataProfile(setProfile);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const [foto, setFoto] = useState<any | null>(null);
|
const [foto, setFoto] = useAtom(gs_fotoProfile)
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
if (profile?.imagesId === undefined || profile?.imagesId === null) {
|
if (profile?.imagesId === undefined || profile?.imagesId === null) {
|
||||||
myConsole("Waiting data");
|
myConsole("Waiting data");
|
||||||
@@ -29,7 +29,7 @@ export default function UploadFotoProfile() {
|
|||||||
<>
|
<>
|
||||||
{/* {JSON.stringify(foto)} */}
|
{/* {JSON.stringify(foto)} */}
|
||||||
<AspectRatio ratio={1 / 1} >
|
<AspectRatio ratio={1 / 1} >
|
||||||
<Paper p={"lg"}>
|
<Paper p={"lg"} shadow="xl">
|
||||||
{foto ? <Image alt="" src={ApiHipmi.get_foto + `${foto}`} /> : <Image alt="" src={"/aset/avatar.png"} />}
|
{foto ? <Image alt="" src={ApiHipmi.get_foto + `${foto}`} /> : <Image alt="" src={"/aset/avatar.png"} />}
|
||||||
</Paper>
|
</Paper>
|
||||||
</AspectRatio>
|
</AspectRatio>
|
||||||
|
|||||||
@@ -30,67 +30,70 @@ import { useAtom } from "jotai";
|
|||||||
import { ApiHipmi } from "@/app/lib/api";
|
import { ApiHipmi } from "@/app/lib/api";
|
||||||
import { loadDataProfile } from "../fun/fun_get_profile";
|
import { loadDataProfile } from "../fun/fun_get_profile";
|
||||||
import { getFotoProfile } from "../api/get-foto-profile";
|
import { getFotoProfile } from "../api/get-foto-profile";
|
||||||
|
import { gs_fotoProfile, gs_profile } from "../state/global_state";
|
||||||
|
|
||||||
export default function ProfileView({data}: {data: any}) {
|
export default function ProfileView({ data }: { data: any }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
//Get data profile
|
//Get data profile
|
||||||
const [profile, setProfile] = useState(data);
|
const [profile, setProfile] = useAtom(gs_profile);
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
loadDataProfile(setProfile);
|
loadDataProfile(setProfile);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const [foto, setFoto] = useState<any | null>(null);
|
const [foto, setFoto] = useAtom(gs_fotoProfile);
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
if (profile?.imagesId === undefined || profile?.imagesId === null) {
|
if (profile?.imagesId === undefined) {
|
||||||
myConsole("Waiting data");
|
return myConsole("Waiting data");
|
||||||
} else {
|
} else {
|
||||||
getFotoProfile(profile.imagesId).then((res) => setFoto(res?.url));
|
getFotoProfile(profile?.imagesId).then((v) => setFoto(v?.url));
|
||||||
}
|
}
|
||||||
myConsole(profile?.imagesId);
|
|
||||||
}, [profile?.imagesId]);
|
}, [profile?.imagesId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* {JSON.stringify(data)} */}
|
{/* {JSON.stringify(data)} */}
|
||||||
{/* Background dan foto */}
|
{/* Background dan foto */}
|
||||||
<Box>
|
<Box>
|
||||||
<Paper bg={"gray"} p={"md"}>
|
<Paper bg={"gray"} p={"md"}>
|
||||||
<Image alt="" src={"/aset/logo.png"} />
|
<Image alt="" src={"/aset/logo.png"} />
|
||||||
</Paper>
|
</Paper>
|
||||||
<Center>
|
<Center>
|
||||||
{foto ? (
|
<Paper
|
||||||
<Image
|
radius={100}
|
||||||
radius={50}
|
h={105}
|
||||||
alt=""
|
w={105}
|
||||||
src={ApiHipmi.get_foto + `${foto}`}
|
sx={{
|
||||||
height={100}
|
borderStyle: "solid",
|
||||||
width={100}
|
borderRadius: "100%",
|
||||||
sx={{
|
borderWidth: 2,
|
||||||
position: "absolute",
|
marginBottom: 10,
|
||||||
marginBottom: 10,
|
paddingBottom: 10,
|
||||||
paddingBottom: 10,
|
position: "absolute",
|
||||||
}}
|
zIndex: 0,
|
||||||
/>
|
}}
|
||||||
) : (
|
>
|
||||||
<Image
|
<Center h={101}>
|
||||||
radius={50}
|
<Image
|
||||||
alt=""
|
src={ApiHipmi.get_foto + foto ?? ""}
|
||||||
src={"/aset/avatar.png"}
|
alt=""
|
||||||
height={100}
|
radius={100}
|
||||||
width={100}
|
width={100}
|
||||||
sx={{
|
height={100}
|
||||||
position: "absolute",
|
sx={
|
||||||
marginBottom: 10,
|
{
|
||||||
paddingBottom: 10,
|
// position: "fixed",
|
||||||
}}
|
}
|
||||||
/>
|
}
|
||||||
)}
|
/>
|
||||||
|
</Center>
|
||||||
|
</Paper>
|
||||||
</Center>
|
</Center>
|
||||||
|
|
||||||
<Center>
|
<Center>
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
mr={-70}
|
mr={-70}
|
||||||
mt={10}
|
mt={15}
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
bg={"gray"}
|
bg={"gray"}
|
||||||
radius={50}
|
radius={50}
|
||||||
|
|||||||
Reference in New Issue
Block a user