small refactor column, new characters endpoint, login/logout improved
This commit is contained in:
parent
ef6bbaf009
commit
90106b844d
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue