diff --git a/scripts/user/getLoggedUserInfo.js b/scripts/user/getLoggedUserInfo.js index c43cbac..1e9356f 100644 --- a/scripts/user/getLoggedUserInfo.js +++ b/scripts/user/getLoggedUserInfo.js @@ -1,4 +1,5 @@ import { apiUrl } from '../constants/apiUrl.js'; +import { serverUrl } from '../constants/serverUrl.js'; import { getAuthorization } from '../utils/getAuthorization.js'; export const getLoggedUseInfo = async () => { @@ -13,6 +14,11 @@ export const getLoggedUseInfo = async () => { }, }); + if (!response.ok) { + localStorage.clear(); + window.location = `${serverUrl}/login`; + } + const data = await response.json(); return {