From 5962a2460be279aedba2f64655e1c1609b36a0bf Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sun, 5 May 2024 12:43:53 -0500 Subject: [PATCH] redirect to login page on 401 --- web/src/api/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/api/index.tsx b/web/src/api/index.tsx index cba5b6962..df6057813 100644 --- a/web/src/api/index.tsx +++ b/web/src/api/index.tsx @@ -25,8 +25,8 @@ export function ApiProvider({ children, options }: ApiProviderType) { return axios.get(path, { params }).then((res) => res.data); }, onError: (error, _key) => { - if (error.status === 401) { - window.location.reload(); + if (error.response.status === 401) { + window.location.href = "login"; } }, ...options,