Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
create const for vars
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax committed Sep 12, 2024
1 parent 5501c0f commit 870009d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions script/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const elm_editor_dark = document.querySelector(".editor_dark");

// Const variables
const APP_URL = "https://auth.salamlang.ir";
const APP_URL_VERIFY_TOKEN = APP_URL + "/api/v1/verify_token";
const APP_URL_SAVE = APP_URL + "/api/v1/codes/save";

// Variables
let token;
Expand Down Expand Up @@ -315,7 +317,7 @@ const save_code = () => {
});
}
};
xhr.open("POST", APP_URL + "/api/v1/codes/save");
xhr.open("POST", APP_URL_SAVE);
xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
xhr.setRequestHeader('Authorization', token);

Expand Down Expand Up @@ -427,7 +429,7 @@ elm_save.addEventListener("click", () => {
get_login();
}
};
xhr.open("GET", APP_URL + "/api/v1/verify_token");
xhr.open("GET", APP_URL_VERIFY_TOKEN);
xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');
xhr.setRequestHeader('Authorization', token);
xhr.send();
Expand Down Expand Up @@ -524,7 +526,7 @@ window.addEventListener('load', () => {
elm_login_btn.style.display = "flex";
}
};
xhr.open("GET", APP_URL + "/api/v1/verify_token");
xhr.open("GET", APP_URL_VERIFY_TOKEN);
xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');
xhr.setRequestHeader('Authorization', token);
xhr.send();
Expand Down

0 comments on commit 870009d

Please sign in to comment.