feat(WEB-215): add refresh_token
This commit is contained in:
committed by
Michael Zetterberg
parent
68f1e87169
commit
c4912bbb94
22
app/[lang]/(live)/(protected)/error.tsx
Normal file
22
app/[lang]/(live)/(protected)/error.tsx
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user