feat(WEB-215): add refresh_token

This commit is contained in:
Simon Emanuelsson
2024-04-24 12:37:47 +02:00
committed by Michael Zetterberg
parent 68f1e87169
commit c4912bbb94
10 changed files with 175 additions and 21 deletions

View File

@@ -0,0 +1,22 @@
"use client"
import { useParams } from "next/navigation"
import { useEffect } from "react"
import { login } from "@/constants/routes/handleAuth"
import { SESSION_EXPIRED } from "@/server/errors/trpc"
import type { ErrorPage } from "@/types/next/error"
import type { LangParams } from "@/types/params"
export default function ProtectedError({ error }: ErrorPage) {
const params = useParams<LangParams>()
useEffect(() => {
if (error.message === SESSION_EXPIRED) {
const loginUrl = login[params.lang]
window.location.assign(loginUrl)
}
}, [error.message, params.lang])
return null
}

View File

@@ -43,7 +43,7 @@ export default async function RootLayout({
<VwoScript />
</head>
<body>
<TrpcProvider>{children}</TrpcProvider>
<TrpcProvider lang={params.lang}>{children}</TrpcProvider>
<Script id="page-tracking">{`
typeof _satellite !== "undefined" && _satellite.pageBottom();
`}</Script>