From e722ded58a928989bb583ae266acf765c129592c Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 8 Nov 2023 16:07:59 -0500 Subject: Add dearrow promo based on title and remove old one Also refactor requests out to seperate file --- src/popup.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/popup.ts') diff --git a/src/popup.ts b/src/popup.ts index 41fb9210..21267afe 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -27,6 +27,7 @@ import GenericNotice from "./render/GenericNotice"; import { getErrorMessage, getFormattedTime } from "../maze-utils/src/formating"; import { StorageChangesObject } from "../maze-utils/src/config"; import { getHash } from "../maze-utils/src/hash"; +import { asyncRequestToServer, sendRequestToServer } from "./utils/requests"; const utils = new Utils(); @@ -295,7 +296,7 @@ async function runThePopup(messageListener?: MessageListener): Promise { const values = ["userName", "viewCount", "minutesSaved", "vip", "permissions"]; - utils.asyncRequestToServer("GET", "/api/userInfo", { + asyncRequestToServer("GET", "/api/userInfo", { publicUserID: await getHash(Config.config.userID), values }).then((res) => { @@ -818,7 +819,7 @@ async function runThePopup(messageListener?: MessageListener): Promise { PageElements.setUsernameStatus.style.display = "unset"; PageElements.setUsernameStatus.innerText = chrome.i18n.getMessage("Loading"); - utils.sendRequestToServer("POST", "/api/setUsername?userID=" + Config.config.userID + "&username=" + PageElements.usernameInput.value, function (response) { + sendRequestToServer("POST", "/api/setUsername?userID=" + Config.config.userID + "&username=" + PageElements.usernameInput.value, function (response) { if (response.status == 200) { //submitted PageElements.submitUsername.style.display = "none"; -- cgit v1.2.3