diff --git a/src/App.vue b/src/App.vue index d32330ffb583d487044a1e59f4703d7072a35ba5..d80fae0b5000eaab01e06674f5084b3da957048d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,13 +1,13 @@ <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> diff --git a/src/components/Exceptions/unkownErrorHandler.ts b/src/components/Exceptions/unkownErrorHandler.ts index 68ecb6e09a91141f60b4641f7f38854a5aa0ca42..e15b5b45d824f51ffc23c860ac394b80b598950f 100644 --- a/src/components/Exceptions/unkownErrorHandler.ts +++ b/src/components/Exceptions/unkownErrorHandler.ts @@ -1,5 +1,6 @@ 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;