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;
|
this.pass = pass;
|
||||||
}
|
}
|
||||||
login = async ():Promise<TokenSession> =>{
|
login = async ():Promise<TokenSession> =>{
|
||||||
removeCookie("XSRF-TOKEN")
|
|
||||||
await sleep(1000)
|
|
||||||
return axios.get(login_endpoint("login"),{withCredentials:false})
|
return axios.get(login_endpoint("login"),{withCredentials:false})
|
||||||
.then(async (x)=>{
|
.then(async (x)=>{
|
||||||
console.log(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)=> {
|
const sleep= async(ms:number)=> {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms))
|
return new Promise(resolve => setTimeout(resolve, ms))
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,9 +57,11 @@ const login = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
storage.RemoveSession()
|
new LogoutHelper().logout().then(()=>{
|
||||||
localStorage.clear()
|
storage.RemoveSession()
|
||||||
window.location.reload()
|
localStorage.clear()
|
||||||
|
window.location.reload()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const s = storage.GetSession()
|
const s = storage.GetSession()
|
||||||
|
@ -83,7 +85,7 @@ updateLogin()
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, computed, PropType, defineProps, defineEmits, ref} from 'vue';
|
import { defineComponent, computed, PropType, defineProps, defineEmits, ref} from 'vue';
|
||||||
import { LTOApiv0 } from '../lib/lifeto';
|
import { LTOApiv0 } from '../lib/lifeto';
|
||||||
import { LoginHelper, Session } from '../lib/session';
|
import { LoginHelper, LogoutHelper, Session } from '../lib/session';
|
||||||
import { storage } from '../session_storage';
|
import { storage } from '../session_storage';
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue