From a2871bca732ec15fffc588ad7cc1155ac8ecd5dd Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 5 Nov 2020 16:20:20 -0500 Subject: [PATCH] Don't show error dialog every error --- app/src/api.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/app/src/api.ts b/app/src/api.ts index b4d6c24ead..c429296ad6 100644 --- a/app/src/api.ts +++ b/app/src/api.ts @@ -1,8 +1,7 @@ import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'; -import { useNotificationsStore, useRequestsStore } from '@/stores/'; +import { useRequestsStore } from '@/stores/'; import { LogoutReason, logout, refresh } from '@/auth'; import getRootPath from '@/utils/get-root-path'; -import i18n from './lang'; const api = axios.create({ baseURL: getRootPath(), @@ -41,7 +40,6 @@ export const onResponse = (response: AxiosResponse | Response) => { }; export const onError = async (error: RequestError) => { - const notificationsStore = useNotificationsStore(); const requestsStore = useRequestsStore(); const id = (error.response.config as RequestConfig).id; requestsStore.endRequest(id); @@ -54,7 +52,6 @@ export const onError = async (error: RequestError) => { const status = error.response?.status; /* istanbul ignore next */ const code = error.response?.data?.errors?.[0]?.extensions?.code; - const message = error.response?.data?.errors?.[0]?.message || undefined; if ( status === 401 && @@ -82,13 +79,6 @@ export const onError = async (error: RequestError) => { } } - notificationsStore.add({ - title: i18n.t(`errors.${code}`), - text: message, - type: 'error', - dialog: true, - }); - return Promise.reject(error); };