fix(auth): make things work

This commit is contained in:
Michael Zetterberg
2024-05-20 09:05:49 +02:00
parent c4912bbb94
commit 476e9f7582
19 changed files with 122 additions and 82 deletions

View File

@@ -1,22 +0,0 @@
"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
}