From c708953342f4775aedcba16dad030356b76eb501 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sat, 4 May 2024 07:21:28 -0500 Subject: [PATCH] reload the window on 401 --- web/src/api/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/src/api/index.tsx b/web/src/api/index.tsx index ea6a25a6c..b42c61fe3 100644 --- a/web/src/api/index.tsx +++ b/web/src/api/index.tsx @@ -24,6 +24,11 @@ export function ApiProvider({ children, options }: ApiProviderType) { const [path, params] = Array.isArray(key) ? key : [key, undefined]; return axios.get(path, { params }).then((res) => res.data); }, + onError: (error, _key) => { + if (error.status === 401) { + window.location.reload(); + } + }, ...options, }} >