fix: redirect users to /refresh on unauth and mod webview links

This commit is contained in:
Christel Westerberg
2024-05-16 16:57:22 +02:00
parent 777fd1e5b6
commit 9e4f41ee46
29 changed files with 358 additions and 105 deletions

13
utils/webviews.ts Normal file
View File

@@ -0,0 +1,13 @@
import { Lang } from "@/constants/languages"
import { webviews } from "@/constants/routes/webviews"
export function modWebviewLink(url: string, lang: Lang) {
const urlWithoutLang = url.replace(`/${lang}`, "")
const webviewUrl = `/${lang}/webview${urlWithoutLang}`
if (webviews.includes(webviewUrl) || url.startsWith("/webview")) {
return webviewUrl
} else {
return url
}
}