Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Administrator
Platform
Commits
74bc58bc
Unverified
Commit
74bc58bc
authored
Sep 16, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle unauthenticated responses
parent
4e6d38c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
app.js
public/js/app.js
+8
-1
app.js
resources/assets/js/app.js
+9
-2
No files found.
public/js/app.js
View file @
74bc58bc
...
...
@@ -31311,13 +31311,20 @@ var app = new _vue2.default({
});
window.axios.interceptors.response.use(null, function (error) {
if (error.response.status === 40
1
) {
if (error.response.status === 40
3
) {
app.$notify.error({
title: app.$t('core.unauthorized'),
message: app.$t('core.unauthorized-access')
});
window.location = route('dashboard.index');
}
if (error.response.status === 401) {
app.$notify.error({
title: app.$t('core.unauthenticated'),
message: app.$t('core.unauthenticated-message')
});
window.location = route('login');
}
return Promise.reject(error);
});
resources/assets/js/app.js
View file @
74bc58bc
...
...
@@ -44,12 +44,19 @@ const app = new Vue({
});
window
.
axios
.
interceptors
.
response
.
use
(
null
,
function
(
error
)
{
if
(
error
.
response
.
status
===
40
1
)
{
if
(
error
.
response
.
status
===
40
3
)
{
app
.
$notify
.
error
({
title
:
app
.
$t
(
'
core.unauthorized
'
),
message
:
app
.
$t
(
'
core.unauthorized-access
'
),
});
window
.
location
=
route
(
'
dashboard.index
'
)
window
.
location
=
route
(
'
dashboard.index
'
);
}
if
(
error
.
response
.
status
===
401
)
{
app
.
$notify
.
error
({
title
:
app
.
$t
(
'
core.unauthenticated
'
),
message
:
app
.
$t
(
'
core.unauthenticated-message
'
),
});
window
.
location
=
route
(
'
login
'
);
}
return
Promise
.
reject
(
error
);
});
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