Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106-2024-07
frontend
Commits
158d2681
Commit
158d2681
authored
1 year ago
by
Henrik
Browse files
Options
Downloads
Patches
Plain Diff
feat: push to login on unauthorized
parent
fcf1c31f
No related branches found
Branches containing commit
No related tags found
1 merge request
!83
feat: push to login on unauthorized
Pipeline
#283474
passed with warnings
1 year ago
Stage: install
Stage: build
Stage: test
Stage: lint
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/App.vue
+3
-3
3 additions, 3 deletions
src/App.vue
src/components/Exceptions/unkownErrorHandler.ts
+6
-0
6 additions, 0 deletions
src/components/Exceptions/unkownErrorHandler.ts
with
9 additions
and
3 deletions
src/App.vue
+
3
−
3
View file @
158d2681
<
script
setup
lang=
"ts"
>
import
{
RouterView
}
from
'
vue-router
'
//
import ErrorBoundaryCatcher from '@/components/Exceptions/ErrorBoundaryCatcher.vue';
import
ErrorBoundaryCatcher
from
'
@/components/Exceptions/ErrorBoundaryCatcher.vue
'
;
</
script
>
<
template
>
<main>
<
e
rror
-b
oundary
-c
atcher>
<
E
rror
B
oundary
C
atcher>
<RouterView
/>
</
e
rror
-b
oundary
-c
atcher>
</
E
rror
B
oundary
C
atcher>
</main>
</
template
>
...
...
This diff is collapsed.
Click to expand it.
src/components/Exceptions/unkownErrorHandler.ts
+
6
−
0
View file @
158d2681
import
{
ApiError
as
BackendApiError
}
from
'
@/api
'
;
import
{
AxiosError
}
from
'
axios
'
;
import
router
from
'
@/router
'
/**
* Finds the correct error message for the given error
...
...
@@ -11,6 +12,11 @@ const handleUnknownError = (error: any): string => {
if
(
error
instanceof
AxiosError
)
{
return
error
.
code
!!
;
}
else
if
(
error
instanceof
BackendApiError
)
{
if
(
error
.
body
.
status
==
403
)
{
router
.
push
(
"
/login
"
);
}
else
if
(
error
.
body
.
status
==
401
)
{
router
.
push
(
"
/roadmap
"
);
}
return
error
.
body
.
message
??
error
.
body
;
}
return
error
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment