From 90106b844dbbf2c6fd3528e3e5f07574858227d2 Mon Sep 17 00:00:00 2001 From: a Date: Wed, 6 Jul 2022 02:54:25 -0500 Subject: [PATCH] small refactor column, new characters endpoint, login/logout improved --- src/lib/session.ts | 10 ++++++++-- src/pages/login.vue | 10 ++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/lib/session.ts b/src/lib/session.ts index efe6bd5..990b69e 100644 --- a/src/lib/session.ts +++ b/src/lib/session.ts @@ -30,8 +30,6 @@ export class LoginHelper { this.pass = pass; } login = async ():Promise =>{ - removeCookie("XSRF-TOKEN") - await sleep(1000) return axios.get(login_endpoint("login"),{withCredentials:false}) .then(async (x)=>{ console.log(x) @@ -54,6 +52,14 @@ export class LoginHelper { }) } } + +export class LogoutHelper{ + constructor(){ + } + logout = async ():Promise =>{ + return axios.get(login_endpoint("logout"),{withCredentials:false}).catch((e)=>{}) + } +} const sleep= async(ms:number)=> { return new Promise(resolve => setTimeout(resolve, ms)) } diff --git a/src/pages/login.vue b/src/pages/login.vue index 9454087..dc3b544 100644 --- a/src/pages/login.vue +++ b/src/pages/login.vue @@ -57,9 +57,11 @@ const login = () => { } const logout = () => { - storage.RemoveSession() - localStorage.clear() - window.location.reload() + new LogoutHelper().logout().then(()=>{ + storage.RemoveSession() + localStorage.clear() + window.location.reload() + }) } const s = storage.GetSession() @@ -83,7 +85,7 @@ updateLogin()