Skip to content

Commit

Permalink
Append path to server specified in config instead of replace
Browse files Browse the repository at this point in the history
Append path to server specified in config instead of replace.

The URL() function emits a URL that doesn't have the path appened when two arguments are specified.  New code simply concatenates the server URL from the config and the API path.
  • Loading branch information
lawrencecandilas committed Feb 7, 2021
1 parent d6e4f0c commit 4d1f52e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions js/background-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async function removeBookmark() {
// Create API URL
var apiURL = "";
try {
apiURL = new URL("/api/bookmarks/ext", config.server);
apiURL = new URL(config.server + "/api/bookmarks/ext");
} catch(err) {
throw new Error(`${config.server} is not a valid url`);
}
Expand Down Expand Up @@ -184,7 +184,7 @@ async function saveBookmark(tags) {
// Create API URL
var apiURL = "";
try {
apiURL = new URL("/api/bookmarks/ext", config.server);
apiURL = new URL(config.server + "/api/bookmarks/ext");
} catch(err) {
throw new Error(`${config.server} is not a valid url`);
}
Expand Down
4 changes: 2 additions & 2 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function logout(server, session) {
// Create logout url
var logoutURL = "";
try {
logoutURL = new URL("/api/logout", server);
logoutURL = new URL(server + "/api/logout");
} catch(err) {
throw new Error(`${server} is not a valid url`);
}
Expand Down Expand Up @@ -64,7 +64,7 @@ async function login(server, username, password) {
// Create login URL
var loginURL = "";
try {
loginURL = new URL("/api/login", server);
loginURL = new URL(server + "/api/login");
} catch(err) {
throw new Error(`${server} is not a valid url`);
}
Expand Down

0 comments on commit 4d1f52e

Please sign in to comment.