Skip to content
Snippets Groups Projects
Commit b7dcdba5 authored by Viktor Gunnar Grevskott's avatar Viktor Gunnar Grevskott
Browse files

Merge branch 'feat/fix-push-to-logout-on-unauthorized' into 'main'

feat: push to login on unauthorized

See merge request !83
parents a1e9136c 158d2681
No related branches found
No related tags found
1 merge request!83feat: push to login on unauthorized
Pipeline #283503 passed with warnings
<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>
<error-boundary-catcher>
<ErrorBoundaryCatcher>
<RouterView />
</error-boundary-catcher>
</ErrorBoundaryCatcher>
</main>
</template>
......
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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment