14 lines
393 B
TypeScript
14 lines
393 B
TypeScript
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
|
|
}
|
|
}
|