Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: remove leading front slash from HOST

thecodrr94e02adf67dd
diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.js
index 7b3964b42..07f8ccc40 100644
--- a/packages/core/api/sync/index.js
+++ b/packages/core/api/sync/index.js
@@ -46,7 +46,7 @@ export default class Sync {
}
async _fetch(lastSynced, token) {
- let response = await fetch(`${HOST}sync?lst=${lastSynced}`, {
+ let response = await fetch(`${HOST}/sync?lst=${lastSynced}`, {
headers: { ...HEADERS, Authorization: `Bearer ${token}` },
});
return await response.json();
@@ -83,7 +83,7 @@ export default class Sync {
}
async _send(data, token) {
- let response = await fetch(`${HOST}sync`, {
+ let response = await fetch(`${HOST}/sync`, {
method: "POST",
headers: { ...HEADERS, Authorization: `Bearer ${token}` },
body: JSON.stringify(data),
diff --git a/packages/core/models/user.js b/packages/core/models/user.js
index 66d186520..991e1df40 100644
--- a/packages/core/models/user.js
+++ b/packages/core/models/user.js
@@ -124,7 +124,7 @@ async function authRequest(endpoint, data, auth = false, get = false) {
};
}
- let response = await fetch(`${HOST}${endpoint}`, {
+ let response = await fetch(`${HOST}/${endpoint}`, {
method: get ? "GET" : "POST",
headers: { ...HEADERS, ...headers },
body: get ? undefined : JSON.stringify(data),
diff --git a/packages/core/utils/constants.js b/packages/core/utils/constants.js
index 2bd3f9449..f5a764446 100644
--- a/packages/core/utils/constants.js
+++ b/packages/core/utils/constants.js
@@ -1,7 +1,7 @@
export const HOST =
process.env.NODE_ENV === "production"
- ? "https://api.notesnook.com/"
- : "http://0.0.0.0:8000/";
+ ? "https://api.notesnook.com"
+ : "http://0.0.0.0:8000";
export const HEADERS = {
agent: "nn/1.0.0",
origin: "notesnook.com",