30 lines
900 B
TypeScript
30 lines
900 B
TypeScript
import React from "react";
|
|
import PageHeader from "@/sections/PageHeader";
|
|
import { cookies } from "next/headers";
|
|
import { getUserFromCookie } from "@/lib/auth";
|
|
import { User } from "@/types";
|
|
import AccountContent from "@/sections/AccountContent";
|
|
import { redirect } from "next/navigation";
|
|
import pb from "@/lib/pocketbase";
|
|
|
|
export default async function AccountPage() {
|
|
const user = (await getUserFromCookie(cookies())) as User;
|
|
const cookie = cookies().get("pb_auth");
|
|
//server side
|
|
pb.authStore.loadFromCookie(cookie?.value || "");
|
|
!pb.authStore.isValid && redirect("/");
|
|
return (
|
|
user && (
|
|
<main
|
|
id="content"
|
|
role="main"
|
|
className="h-full flex flex-col min-h-screen mx-auto w-screen overflow-hidden bg-base-100 "
|
|
>
|
|
<PageHeader title="Account" subtitle={<></>} />
|
|
|
|
<AccountContent user={user} />
|
|
</main>
|
|
)
|
|
);
|
|
}
|