encrypt and decrypt persistent tokens

This commit is contained in:
Ryan
2025-03-23 23:29:51 -04:00
committed by GitHub
parent 0215bd3d76
commit 5892236aa9
4 changed files with 109 additions and 37 deletions

View File

@@ -1,4 +1,3 @@
// networkUtils.js
export function sendRequest(url, method = "GET", data = null) {
console.log("Sending request to:", url, "with method:", method);
const options = {
@@ -24,9 +23,11 @@ export function sendRequest(url, method = "GET", data = null) {
throw new Error(`HTTP error ${response.status}: ${text}`);
});
}
// Clone the response so we can safely fall back if JSON parsing fails.
const clonedResponse = response.clone();
return response.json().catch(() => {
console.warn("Response is not JSON, returning as text");
return response.text();
return clonedResponse.text();
});
});
}