From aa02700e4c5fe3b182250e4a4250708081fcbf9a Mon Sep 17 00:00:00 2001 From: Nathnael Date: Mon, 20 Jul 2026 11:52:08 +0000 Subject: [PATCH] fix: disable global errors --- apps/edr-freight-web/backoffice/src/auth/http.ts | 8 ++------ apps/edr-freight-web/portal/src/utils/api.ts | 15 +++++---------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/apps/edr-freight-web/backoffice/src/auth/http.ts b/apps/edr-freight-web/backoffice/src/auth/http.ts index 9fe86ab1e..b31fd836a 100644 --- a/apps/edr-freight-web/backoffice/src/auth/http.ts +++ b/apps/edr-freight-web/backoffice/src/auth/http.ts @@ -1,10 +1,6 @@ import axios from "axios"; import { API_BASE_URL } from "@/constants/apiConfig"; -import { - emitApiError, - extractApiErrorPayload, -} from "@/components/errors/ApiErrorModal"; import { captureApiError } from "@/lib/posthog"; import { AUTH_TOKEN_COOKIE, @@ -120,8 +116,8 @@ api.interceptors.response.use( error.response.status !== 401 && !originalRequest?.suppressErrorModal ) { - const payload = extractApiErrorPayload(error); - if (payload) emitApiError(payload); + // const payload = extractApiErrorPayload(error); + // if (payload) emitApiError(payload); } return Promise.reject(error); } diff --git a/apps/edr-freight-web/portal/src/utils/api.ts b/apps/edr-freight-web/portal/src/utils/api.ts index 69dfe308f..a316d9520 100644 --- a/apps/edr-freight-web/portal/src/utils/api.ts +++ b/apps/edr-freight-web/portal/src/utils/api.ts @@ -2,10 +2,6 @@ import { UseQueryOptions, QueryObserverOptions } from "@tanstack/react-query"; import axios, { AxiosError, InternalAxiosRequestConfig } from "axios"; import { URL_CONSTANTS } from "@/constants/URLS"; import { API_BASE_URL } from "@/constants/apiConfig"; -import { - emitApiError, - extractApiErrorPayload, -} from "@/components/errors/ApiErrorModal"; import { captureApiError } from "@/lib/posthog"; const client = axios.create({ @@ -63,10 +59,9 @@ async function refreshSessionTokens(): Promise { } type TokenPair = { token: string; refreshToken: string }; - const { data } = await client.post & { data?: TokenPair }>( - URL_CONSTANTS.AUTH.REFRESH_TOKEN, - { refreshToken }, - ); + const { data } = await client.post< + Partial & { data?: TokenPair } + >(URL_CONSTANTS.AUTH.REFRESH_TOKEN, { refreshToken }); // The API returns the pair flat ({ success, token, refreshToken }); accept // a { data: { ... } }-wrapped shape too so a transform change can't // silently break refresh again. @@ -118,8 +113,8 @@ client.interceptors.response.use( // Surface the server's actual error message in the global error modal // (401s are handled by the session flow below/redirects, so skip them). if (error.response && error.response.status !== 401) { - const payload = extractApiErrorPayload(error); - if (payload) emitApiError(payload); + // const payload = extractApiErrorPayload(error); + // if (payload) emitApiError(payload); } return Promise.reject(error); }