summaryrefslogtreecommitdiff
path: root/rushs/eplace/src/pages/debug.js
blob: e2da5f4d3d10abfc3ca18a9e122bd1b4b5b19f5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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();
    });
}