From b668142de671297a07094ed51f516f51d7d6e1d2 Mon Sep 17 00:00:00 2001 From: anulax1225 Date: Fri, 15 Dec 2023 20:09:23 +0100 Subject: [PATCH] Added registeration and relog --- html/template.html | 1 + js/auth/auth.js | 2 +- js/index.js | 16 ++++++++++------ js/ui/templeting_engine.js | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/html/template.html b/html/template.html index 68962a6..959f521 100644 --- a/html/template.html +++ b/html/template.html @@ -11,6 +11,7 @@
+
diff --git a/js/auth/auth.js b/js/auth/auth.js index bc2033c..80773ec 100644 --- a/js/auth/auth.js +++ b/js/auth/auth.js @@ -58,7 +58,7 @@ export class Auth { } async relog() { - if(this.is_login()) await AgentBuilder.get(localStorage.getItem("token"), this.validated, this.error_handler); + if(this.#is_login()) await AgentBuilder.get(localStorage.getItem("token"), this.validated, this.error_handler); else return false; } diff --git a/js/index.js b/js/index.js index 76e3a20..727e60b 100644 --- a/js/index.js +++ b/js/index.js @@ -4,13 +4,15 @@ import { UIRenderer } from "./ui/templeting_engine.js"; import { Initialzer } from "./commun/commun.js"; import { AgentBuilder } from "./api/agent.js"; import { Auth } from "./auth/auth.js"; - +let store; let token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGlmaWVyIjoiSEFSRElDSyIsInZlcnNpb24iOiJ2Mi4xLjQiLCJyZXNldF9kYXRlIjoiMjAyMy0xMi0wMiIsImlhdCI6MTcwMjY2Mjc2Mywic3ViIjoiYWdlbnQtdG9rZW4ifQ.PrvaOz3W79acq6RoxryMW53PRRz824_AM0VGLwfXCOsGCOCAIY-rn6-bZTOnLAtp4xPSDqEk4c38oWYAWW59p0iMDDLpur6ONnjT0RjjsQS9zr5BByfBpP36CT23IZSSzk3XxGrFolHJAyU3K1liYfNbsPuNTXlkHGNHq6yMqH4ZQUPFsXEsCkg9cUynkdLw3C39SvWhtJ89oblj_8tQp2k8dxhZemepuXtiI51eFMpv8A0WRAi7pVYo_ajJujY9QDLYn_m5hDZWTlQMIstjPaDl99p2IMweIMO2Q2G-0lKiWQ4sl6VW5tuVrz1HLYU6kyMjFQWNn6kFDE7LWMTrfw"; let UI = new UIRenderer("html"); let initer = new Initialzer(UI); + UI.render("templates/home.html"); +UI.frag_load("#test", "templates/login.html"); -let auth = new Auth(); +let auth = new Auth(store = true); auth.done((agent) => { console.log(agent); }).fail((errs) => { @@ -18,11 +20,13 @@ auth.done((agent) => { console.log(err); }); }); +auth.login(token); +auth.relog(); -await auth.register({ - symbol: "lkdsjfsjdlfjlk", - faction: "COSMIC" -}); +//await auth.register({ +// symbol: "lkdsjfsjdlfjlk", +// faction: "COSMIC" +//}); $(document).ready(() => { initer.init_menu_link("#contracts-link", "contracts.html"); diff --git a/js/ui/templeting_engine.js b/js/ui/templeting_engine.js index d18f79c..d51dcf1 100644 --- a/js/ui/templeting_engine.js +++ b/js/ui/templeting_engine.js @@ -9,7 +9,7 @@ export class UIRenderer { this.#get_template((reponse) => { $('body').html(reponse); this.#get_template((reponse) => { - $("block-content").html(reponse); + $("#block-content").html(reponse); }, template) }); }