diff --git a/src/hooks/use-axios.tsx b/src/hooks/use-axios.tsx index ebe2c724b..94f6a946f 100644 --- a/src/hooks/use-axios.tsx +++ b/src/hooks/use-axios.tsx @@ -1,5 +1,5 @@ import axios from "redaxios" -import { useMemo } from "react" +import { useMemo, useRef } from "react" import { useGlobalStore } from "./use-global-store" import { useApiBaseUrl } from "./use-packages-base-api-url" import { toast, ToastContent, useToast } from "./use-toast" @@ -10,6 +10,8 @@ export const useAxios = () => { const session = useGlobalStore((s) => s.session) const { toastLibrary } = useToast() const signIn = useSignIn() + const unauthorizedToastShownRef = useRef(false) + return useMemo(() => { const instance = axios.create({ baseURL: snippetsBaseApiUrl, @@ -32,23 +34,38 @@ export const useAxios = () => { const status = error?.response?.status ?? error?.status if (status === 401) { - toastLibrary.custom( - (t) => ( -