summaryrefslogtreecommitdiff
path: root/rushs/eplace/src/pages/debug.js
diff options
context:
space:
mode:
Diffstat (limited to 'rushs/eplace/src/pages/debug.js')
-rw-r--r--rushs/eplace/src/pages/debug.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/rushs/eplace/src/pages/debug.js b/rushs/eplace/src/pages/debug.js
new file mode 100644
index 0000000..e2da5f4
--- /dev/null
+++ b/rushs/eplace/src/pages/debug.js
@@ -0,0 +1,34 @@
+import $ from "jquery";
+import debugHtml from "../components/debug.html";
+
+function refreshLocalStorage() {
+ $("#token").text(localStorage.getItem("token") ?? "N/A");
+ $("#refresh_token").text(localStorage.getItem("refresh_token") ?? "N/A");
+}
+
+if (import.meta.env.MODE === "debug") {
+ $.get(debugHtml, function (response) {
+ $("body").html(response);
+ refreshLocalStorage();
+ }).fail(function (xhr, status, error) {
+ console.error("Error fetching debug HTML:", error);
+ });
+
+ $(document).on("click", "#errorBtn", function () {
+ // Make a call to VITE_URL/tests/error using your own api call function
+ });
+
+ $(document).on("click", "#expiredTokenBtn", function () {
+ // Make a call to VITE_URL/tests/expired using your own api call function
+ });
+
+ $(document).on("click", "#deleteTokenBtn", function () {
+ localStorage.removeItem("token");
+ refreshLocalStorage();
+ });
+
+ $(document).on("click", "#deleteRefreshTokenBtn", function () {
+ localStorage.removeItem("refresh_token");
+ refreshLocalStorage();
+ });
+}