Desc:
- Penambahan function
- Perubahan tampilan
This commit is contained in:
2023-10-09 15:50:15 +08:00
parent 6281452441
commit ca66c3d2d8
12 changed files with 172 additions and 96 deletions

View File

@@ -4,22 +4,23 @@ import { unsealData } from "iron-session";
import _ from "lodash";
import { redirect } from "next/navigation";
import yaml from "yaml";
import fs from "fs";
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
export default async function Page() {
const c = cookies().get("ssn");
// const tkn = !c
// ? null
// : JSON.parse(
// await unsealData(c.value as string, {
// password: process.env.PWD as string,
// })
// );
// if (!c?.value) return redirect("/dev/auth/login");
if (!c?.value) return redirect("/dev/auth/login");
const usr = JSON.parse(
await unsealData(c?.value as string, {
password: config.server.password,
})
);
return (
<>
{/* {JSON.stringify(tkn)} */}
<HomeView />
<HomeView user={usr} />
</>
);
}

View File

@@ -1,14 +1,33 @@
import prisma from "@/app/lib/prisma";
import { loadListPortofolio } from "@/app_modules/katalog/portofolio/fun/fun_get_all_portofolio";
import { getProfile } from "@/app_modules/katalog/profile";
import { KatalogView } from "@/app_modules/katalog/view";
import { url } from "inspector";
import { unsealData } from "iron-session";
import _, { get } from "lodash";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
import yaml from "yaml";
import fs from "fs";
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
export default async function Page() {
const data = await getProfile();
const listPorto = await loadListPortofolio(data?.id as string)
const u = cookies().get("ssn");
const usr = JSON.parse(
await unsealData(u?.value as string, {
password: config.server.password,
})
);
const user = await funGetUserProfile(usr.id);
return (
<>
{/* {JSON.stringify(data)} */}
<KatalogView data={data} porto={listPorto} />
<KatalogView user={user as any} />
</>
);
}