small refactor column, new characters endpoint, login/logout improved

This commit is contained in:
a 2022-07-06 02:54:25 -05:00
parent ef6bbaf009
commit 90106b844d
2 changed files with 14 additions and 6 deletions

View File

@ -30,8 +30,6 @@ export class LoginHelper {
this.pass = pass;
}
login = async ():Promise<TokenSession> =>{
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<void> =>{
return axios.get(login_endpoint("logout"),{withCredentials:false}).catch((e)=>{})
}
}
const sleep= async(ms:number)=> {
return new Promise(resolve => setTimeout(resolve, ms))
}

View File

@ -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()
<script lang="ts">
import { defineComponent, computed, PropType, defineProps, defineEmits, ref} from 'vue';
import { LTOApiv0 } from '../lib/lifeto';
import { LoginHelper, Session } from '../lib/session';
import { LoginHelper, LogoutHelper, Session } from '../lib/session';
import { storage } from '../session_storage';
</script>