Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
K
kiaisoft_tuananh_nuxt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TTS Tran Viet Anh
kiaisoft_tuananh_nuxt
Commits
47bd40b3
Commit
47bd40b3
authored
Feb 06, 2023
by
TTS Kieu Tuan Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
axios logout
parent
63274c7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
Navbar.vue
components/Navbar.vue
+24
-14
No files found.
components/Navbar.vue
View file @
47bd40b3
...
...
@@ -43,22 +43,32 @@
export
default
{
methods
:
{
logout
()
{
fetch
(
'
http://127.0.0.1:8000/api/logout
'
,
{
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
,
accept
:
'
application/json
'
},
body
:
JSON
.
stringify
({
async
logout
()
{
try
{
const
resp
=
await
this
.
$axios
.
post
(
'
/logout
'
,
{
token
:
this
.
$auth
.
$storage
.
getUniversal
(
'
token
'
)
},
{
headers
:
{
'
Content-Type
'
:
'
application/json
'
,
accept
:
'
application/json
'
}
})
if
(
resp
.
status
==
'
200
'
)
{
this
.
$toast
.
success
(
'
Successfully authenticated
'
,
{
duration
:
2000
})
this
.
$router
.
push
(
'
/login
'
)
localStorage
.
setItem
(
'
token
'
,
''
)
this
.
$auth
.
$storage
.
setUniversal
(
'
loggedIn
'
,
'
false
'
)
this
.
$auth
.
$storage
.
setUniversal
(
'
token
'
,
''
)
this
.
$auth
.
$storage
.
setUniversal
(
'
userName
'
,
''
)
}
}
catch
(
e
)
{
this
.
$toast
.
error
(
'
ERR !
'
,
{
duration
:
2000
})
})
localStorage
.
setItem
(
'
token
'
,
''
)
this
.
$auth
.
$storage
.
setUniversal
(
'
loggedIn
'
,
'
false
'
)
this
.
$auth
.
$storage
.
setUniversal
(
'
token
'
,
''
)
this
.
$auth
.
$storage
.
setUniversal
(
'
userName
'
,
''
)
this
.
$router
.
push
(
'
/login
'
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment