23 lines
613 B
TypeScript
23 lines
613 B
TypeScript
"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
|
|
}
|