From 49a9205adefd05c4a6a11127b9d598dd0de39f49 Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Fri, 3 Feb 2023 20:21:28 +0700 Subject: [PATCH] fix(fix get-matches): fix get-matches --- src/features/HomePage/hooks.tsx | 2 +- src/helpers/callApi/logoutIfUnauthorized.tsx | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/features/HomePage/hooks.tsx b/src/features/HomePage/hooks.tsx index 4fb0f3c7..104cdf16 100644 --- a/src/features/HomePage/hooks.tsx +++ b/src/features/HomePage/hooks.tsx @@ -75,7 +75,7 @@ export const useHomePage = () => { timezoneOffset: getTimezoneOffset(selectedDate), }), // eslint-disable-next-line react-hooks/exhaustive-deps - [selectedDate, userInfo], + [selectedDate], ) useEffect(() => { diff --git a/src/helpers/callApi/logoutIfUnauthorized.tsx b/src/helpers/callApi/logoutIfUnauthorized.tsx index 2371f5eb..f7f68cdf 100644 --- a/src/helpers/callApi/logoutIfUnauthorized.tsx +++ b/src/helpers/callApi/logoutIfUnauthorized.tsx @@ -1,9 +1,11 @@ +import { removeToken } from '../token' + export const logoutIfUnauthorized = async (response: Response) => { /* отключили из-за доступа без авторизации */ - // if (response.status === 401 || response.status === 403) { - // removeToken() - // window.dispatchEvent(new Event('FORBIDDEN_REQUEST')) - // } + if (response.status === 401 || response.status === 403) { + removeToken() + window.dispatchEvent(new Event('FORBIDDEN_REQUEST')) + } const error = new Error(response.statusText) // eslint-disable-next-line no-console