Fix createURL
The Javascript URL object takes a second argument which is the base to use for the URL. However it only accepts the "root" of the base. So arguments such as http://localhost/example get silently turned into http://localhost/ This change places the baseURL within the path element, after making sure that it ends with a slash (/).
This commit is contained in:
parent
b16982df0f
commit
cf86ff57de
@ -62,7 +62,11 @@ export function removePrefix(url) {
|
||||
}
|
||||
|
||||
export function createURL(endpoint, params = {}, auth = true) {
|
||||
const url = new URL(encodePath(endpoint), origin + baseURL);
|
||||
let prefix = baseURL;
|
||||
if (prefix[prefix.length] != '/') {
|
||||
prefix = prefix + '/';
|
||||
}
|
||||
const url = new URL(prefix + encodePath(endpoint), origin);
|
||||
|
||||
const searchParams = {
|
||||
...(auth && { auth: store.state.jwt }),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user