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
035cdff9
Commit
035cdff9
authored
Feb 06, 2023
by
TTS Kieu Tuan Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove header
parent
47bd40b3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
20 deletions
+10
-20
Navbar.vue
components/Navbar.vue
+1
-7
login.vue
pages/login.vue
+3
-8
axios.js
plugins/axios.js
+6
-5
No files found.
components/Navbar.vue
View file @
035cdff9
...
...
@@ -47,15 +47,9 @@ export default {
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
'
,
{
this
.
$toast
.
success
(
'
Logout!
'
,
{
duration
:
2000
})
this
.
$router
.
push
(
'
/login
'
)
...
...
pages/login.vue
View file @
035cdff9
...
...
@@ -115,13 +115,7 @@ export default {
{
email
:
this
.
email
,
password
:
this
.
password
,
status
:
this
.
status
,
},
{
headers
:
{
'
Content-Type
'
:
'
application/json
'
,
Accept
:
'
application/json
'
,
}
status
:
this
.
status
})
localStorage
.
setItem
(
"
token
"
,
resp
.
data
.
data
.
bearer_token
)
this
.
$auth
.
$storage
.
setUniversal
(
"
token
"
,
resp
.
data
.
data
.
bearer_token
)
...
...
@@ -141,6 +135,7 @@ export default {
}
}
}
}
</
script
>
<
style
scoped
>
.body
{
...
...
plugins/axios.js
View file @
035cdff9
export
default
function
({
$axios
},
inject
,
redirect
)
{
$axios
.
onError
(
error
=>
{
if
(
error
.
response
.
status
===
500
)
{
$axios
.
onError
(
(
error
)
=>
{
if
(
error
.
response
.
status
===
500
)
{
redirect
(
'
/500
'
)
}
})
$axios
.
onError
(
error
=>
{
$axios
.
onError
(
(
error
)
=>
{
const
code
=
parseInt
(
error
.
response
&&
error
.
response
.
status
)
if
(
code
===
400
)
{
redirect
(
'
/400
'
)
...
...
@@ -15,7 +15,8 @@ export default function ({ $axios }, inject, redirect) {
const
api
=
$axios
.
create
({
headers
:
{
common
:
{
Accept
:
'
application/json, text/plain, */*
'
Accept
:
'
application/json, text/plain, */*
'
,
'
Content-Type
'
:
'
application/json, text/plain, */*
'
}
}
})
...
...
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