diff options
Diffstat (limited to 'lib/vnlib.browser')
-rw-r--r-- | lib/vnlib.browser/src/axios/index.ts | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/vnlib.browser/src/axios/index.ts b/lib/vnlib.browser/src/axios/index.ts index 2780102..6a2135f 100644 --- a/lib/vnlib.browser/src/axios/index.ts +++ b/lib/vnlib.browser/src/axios/index.ts @@ -36,8 +36,23 @@ const configureAxiosInternal = (instance: Axios, session: ISession, tokenHeader: // See if the current session is logged in if (tokenHeaderValue && loggedIn.value) { - // Get an otp for the request - config.headers[tokenHeaderValue] = await generateOneTimeToken(config.url!); + + const path = `${config.baseURL}${config.url}` + + //see if absolute url or relative + if(path.match(/https?:\/\//)){ + //Is absolute + const { pathname } = new URL(path); + + // Get an otp for the request + config.headers[tokenHeaderValue] = await generateOneTimeToken(pathname); + } + else{ + //Is relative + + // Get an otp for the request + config.headers[tokenHeaderValue] = await generateOneTimeToken(path); + } } // Return the config return config |