fix: redirect users to /refresh on unauth and mod webview links
This commit is contained in:
13
utils/webviews.ts
Normal file
13
utils/webviews.ts
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user