Skip to content

Commit

Permalink
added remove base
Browse files Browse the repository at this point in the history
  • Loading branch information
wassfila committed Jun 17, 2024
1 parent 8b23339 commit 9473fbb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libs/redirect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {config} from '@/client_config.js'
import { remove_base } from './client_utils'

export async function redirectToFullUrl() {
if(document.title == "not found"){
Expand All @@ -9,7 +10,10 @@ export async function redirectToFullUrl() {

const response = await fetch(`${config.base}/api/redirect`)
const redirects = await response.json()
let pathname = window.location.pathname.substring(1)
let pathname = remove_base(window.location.pathname)
if(pathname.startsWith("/")){
pathname = pathname.substring(1)
}
if (pathname in redirects) {
const new_url = redirects[pathname]
if(new_url){
Expand Down

0 comments on commit 9473fbb

Please sign in to comment.