forked from extern/homer
Check if path has data before adding /
This commit is contained in:
parent
ba2c7c5c57
commit
1340a8e6d0
@ -31,7 +31,13 @@ export default {
|
||||
path = path.slice(1);
|
||||
}
|
||||
|
||||
return fetch(`${this.endpoint}/${path}`, options).then((response) => {
|
||||
let url = this.endpoint;
|
||||
|
||||
if (path) {
|
||||
url = `${this.endpoint}/${path}`;
|
||||
}
|
||||
|
||||
return fetch(url, options).then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Not 2xx response");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user