CoastalCommitsPastes/client/app/settings/page.tsx
2022-11-12 01:28:06 -08:00

37 lines
904 B
TypeScript

import Header from "@components/header"
import SettingsGroup from "../components/settings-group"
import Password from "app/settings/components/sections/password"
import Profile from "app/settings/components/sections/profile"
import { authOptions } from "@lib/server/auth"
import { getCurrentUser } from "@lib/server/session"
import { redirect } from "next/navigation"
export default async function SettingsPage() {
const user = await getCurrentUser()
if (!user) {
redirect(authOptions.pages?.signIn || "/new")
}
return (
<>
<Header signedIn />
<div
style={{
display: "flex",
flexDirection: "column",
gap: "var(--gap)",
marginBottom: "var(--gap)"
}}
>
<h1>Settings</h1>
<SettingsGroup title="Profile">
<Profile user={user} />
</SettingsGroup>
<SettingsGroup title="Password">
<Password />
</SettingsGroup>
</div>
</>
)
}