Add authentication check and logout functionality in app.vue
This commit is contained in:
parent
ee00a8018e
commit
733a1e9f47
9 changed files with 1294 additions and 1653 deletions
11
server/api/auth/logout.post.js
Normal file
11
server/api/auth/logout.post.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export default defineEventHandler(async (event) => {
|
||||
const token = getCookie(event, 'auth-token')
|
||||
|
||||
if (token) {
|
||||
await useStorage('memory').removeItem(`session:${token}`)
|
||||
}
|
||||
|
||||
deleteCookie(event, 'auth-token')
|
||||
|
||||
return { success: true }
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue