title: auto
des: auto note:auto
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
export function myConsole(value: any) {
|
export function myConsole(value: any) {
|
||||||
const onData = false
|
const onData = true
|
||||||
if (onData) {
|
if (onData) {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Box,
|
Box,
|
||||||
|
Center,
|
||||||
Flex,
|
Flex,
|
||||||
Image,
|
Image,
|
||||||
Loader,
|
Loader,
|
||||||
@@ -90,14 +91,15 @@ const listHalaman = [
|
|||||||
|
|
||||||
export default function HomeView() {
|
export default function HomeView() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [token, setToken] = useAtom(gs_token);
|
|
||||||
|
|
||||||
|
const [token, setToken] = useAtom(gs_token);
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
getUserId();
|
getUserId();
|
||||||
}, []);
|
}, []);
|
||||||
async function getUserId() {
|
async function getUserId() {
|
||||||
const data = await getToken();
|
const get = await getToken();
|
||||||
setToken(data);
|
if(!get) return myConsole("Data Kosong")
|
||||||
|
setToken(get);
|
||||||
}
|
}
|
||||||
|
|
||||||
const [profile, setProfile] = useAtom(gs_profile);
|
const [profile, setProfile] = useAtom(gs_profile);
|
||||||
@@ -105,43 +107,38 @@ export default function HomeView() {
|
|||||||
loadProfile();
|
loadProfile();
|
||||||
}, []);
|
}, []);
|
||||||
async function loadProfile() {
|
async function loadProfile() {
|
||||||
const data = await getProfile();
|
const get = await getProfile();
|
||||||
|
if(!get) return myConsole("Data Kosong")
|
||||||
setProfile(data);
|
setProfile(get);
|
||||||
}
|
}
|
||||||
|
|
||||||
// const [foto, setFoto] = useAtom(gs_fotoProfile);
|
const [foto, setFoto] = useAtom(gs_fotoProfile);
|
||||||
// useShallowEffect(() => {
|
|
||||||
// getFoto(profile?.imagesId);
|
|
||||||
// // if (profile?.imagesId === undefined) {
|
|
||||||
// // return myConsole("Waiting data");
|
|
||||||
// // } else {
|
|
||||||
// // getFoto(profile?.imagesId);
|
|
||||||
// // }
|
|
||||||
// }, [profile?.imagesId]);
|
|
||||||
|
|
||||||
// async function getFoto(id: string) {
|
|
||||||
// if(id === undefined){
|
|
||||||
// return myConsole("Waiting data")
|
|
||||||
// } else {
|
|
||||||
// const data = await getFotoProfile(id);
|
|
||||||
// setFoto(data);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
const [listPorto, setListPorto] = useAtom(gs_ListPortofolio);
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
getListPorto(profile?.id);
|
getFoto(profile?.imagesId);
|
||||||
}, [profile?.id]);
|
}, [profile?.imagesId]);
|
||||||
async function getListPorto(id: string) {
|
|
||||||
const data = await getListPortofolio(id);
|
async function getFoto(id: string) {
|
||||||
setListPorto(data);
|
if(id === undefined){
|
||||||
|
return myConsole("Waiting data")
|
||||||
|
} else {
|
||||||
|
const data = await getFotoProfile(id);
|
||||||
|
setFoto(data?.url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const [listPorto, setListPorto] = useAtom(gs_ListPortofolio);
|
||||||
|
// useShallowEffect(() => {
|
||||||
|
// getListPorto(profile?.id);
|
||||||
|
// }, [profile?.id]);
|
||||||
|
// async function getListPorto(id: string) {
|
||||||
|
// const data = await getListPortofolio(id);
|
||||||
|
// setListPorto(data);
|
||||||
|
// }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <pre>{JSON.stringify(profile, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(foto, null, 2)}</pre> */}
|
||||||
|
<Center><Image src={ApiHipmi.get_foto + foto ?? ""} alt="" height={100} width={100}/></Center>
|
||||||
<Box>
|
<Box>
|
||||||
<Flex align={"center"} gap={"sm"}>
|
<Flex align={"center"} gap={"sm"}>
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
|
|||||||
Reference in New Issue
Block a user