mirror of
https://github.com/bastienwirtz/homer.git
synced 2024-11-07 16:54:00 +01:00
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