feat: add login and print user object on my-pages
This commit is contained in:
committed by
Simon Emanuelsson
parent
f1278a8d11
commit
70f9c22410
12
app/[lang]/(live)/(protected)/my-pages/page.tsx
Normal file
12
app/[lang]/(live)/(protected)/my-pages/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { auth } from "@/auth"
|
||||
|
||||
export default async function MyPages() {
|
||||
const session = await auth()
|
||||
console.log({ session })
|
||||
return (
|
||||
<>
|
||||
<h2>Wilkommen</h2>
|
||||
<pre>{JSON.stringify(session, null, 2)}</pre>
|
||||
</>
|
||||
)
|
||||
}
|
||||
21
app/[lang]/(live)/(public)/login/page.tsx
Normal file
21
app/[lang]/(live)/(public)/login/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { signIn } from "@/auth"
|
||||
import { pageNames } from "@/constants/myPages"
|
||||
|
||||
import type { LangParams, Params } from "@/types/params"
|
||||
|
||||
export default async function Page({ params }: Params<LangParams>) {
|
||||
async function login() {
|
||||
"use server"
|
||||
await signIn("curity", {
|
||||
redirectTo: `/${params.lang}/${pageNames[params.lang]}`,
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<main>
|
||||
<form action={login}>
|
||||
<button type="submit">Sign In</button>
|
||||
</form>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user