Skip to content
Snippets Groups Projects
Commit 158d2681 authored by Henrik's avatar Henrik
Browse files

feat: push to login on unauthorized

parent fcf1c31f
No related branches found
No related tags found
1 merge request!83feat: push to login on unauthorized
Pipeline #283474 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