redirect to login page on 401

This commit is contained in:
Blake Blackshear 2024-05-05 12:43:53 -05:00
parent 8310063501
commit 5962a2460b

View File

@ -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,