mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
fix: disable global errors
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<string> {
|
||||
}
|
||||
|
||||
type TokenPair = { token: string; refreshToken: string };
|
||||
const { data } = await client.post<Partial<TokenPair> & { data?: TokenPair }>(
|
||||
URL_CONSTANTS.AUTH.REFRESH_TOKEN,
|
||||
{ refreshToken },
|
||||
);
|
||||
const { data } = await client.post<
|
||||
Partial<TokenPair> & { 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user