feat(web): initialize frontend

This commit is contained in:
2023-01-27 01:33:23 +03:00
parent 47ee5c4776
commit ebb3836930
40 changed files with 297 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
$(window).on("load", function () {
let authorized = true;
if ($.cookie("token") == null) {
authorized = false;
$.ajax({
url: "/token",
type: "POST",
contentType: "application/json",
data: `{"token":"${$.cookie("token")}"}`,
dataType: "json",
success: function (resp) {
if (resp.status) {
authorized = true;
}
},
failure: function (err) {
alert(err);
}
});
}
if (!authorized) {
$(location).attr("href", "/auth");
}
});