fix: set cookie in header on rewrite
This commit is contained in:
@@ -10,8 +10,6 @@ import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import MaxWidth from "@/components/MaxWidth"
|
||||
import Content from "@/components/MyPages/AccountPage/Webview/Content"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import Title from "@/components/Title"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
|
||||
@@ -39,6 +37,18 @@ export default async function MyPages({
|
||||
return notFound()
|
||||
}
|
||||
|
||||
// Check if the access token is valid. If not, redirect to the refresh page.
|
||||
await serverClient({
|
||||
onError(opts) {
|
||||
const returnUrl = new URLSearchParams({
|
||||
returnurl: `${params.lang}/webview/${searchParams.uri}`,
|
||||
})
|
||||
|
||||
const refreshUrl = `/${params.lang}/webview/refresh?${returnUrl.toString()}`
|
||||
redirect(refreshUrl)
|
||||
},
|
||||
}).user.get()
|
||||
|
||||
const accountPage = await serverClient({
|
||||
onError() {
|
||||
const returnUrl = new URLSearchParams({
|
||||
@@ -57,10 +67,6 @@ export default async function MyPages({
|
||||
|
||||
return (
|
||||
<MaxWidth className={styles.blocks} tag="main">
|
||||
<header>
|
||||
<Title as="h2">{_("Welcome")}</Title>
|
||||
<Link href={link.href}>{link.title}</Link>
|
||||
</header>
|
||||
<Content lang={params.lang} content={accountPage.content} />
|
||||
</MaxWidth>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user