fix login and create logout
fix login to login by email password
This commit is contained in:
parent
19b4d18941
commit
48e29ee9fd
3 changed files with 795 additions and 7 deletions
|
@ -55,7 +55,7 @@
|
|||
</v-list-item>
|
||||
</v-list>
|
||||
|
||||
<v-btn class = "ma-2 mt-3" width="100%"
|
||||
<v-btn @click.prevent="logout" class = "ma-2 mt-3" width="100%"
|
||||
color="red">
|
||||
ลงชื่อออก
|
||||
</v-btn>
|
||||
|
@ -69,6 +69,8 @@
|
|||
<script setup>
|
||||
|
||||
import {RouterLink} from 'vue-router';
|
||||
import { VContainer } from 'vuetify/lib/components/index.mjs';
|
||||
import router from '@/plugins/router'
|
||||
|
||||
const account_items = [
|
||||
{ text: 'ตั้งค่าบัญชี',
|
||||
|
@ -90,5 +92,17 @@ const display_items = [
|
|||
icon: 'mdi-chevron-right',}
|
||||
]
|
||||
|
||||
function logout() {
|
||||
if (sessionStorage.getItem('current_user')){
|
||||
console.log('loging out...');
|
||||
fetch(`https://little-lines-backend.techtransthai.org/api/users/logout`, {
|
||||
method: "GET"
|
||||
}).then(()=>{
|
||||
console.log('loged out');
|
||||
sessionStorage.removeItem('current_user');
|
||||
router.push({ name: 'home' });
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue