diff --git a/src/components/Dropdown/Calendar/Calendar.jsx b/src/components/Dropdown/Calendar/Calendar.jsx index e50ad87c4..da23fe1eb 100644 --- a/src/components/Dropdown/Calendar/Calendar.jsx +++ b/src/components/Dropdown/Calendar/Calendar.jsx @@ -7,12 +7,11 @@ import { PathName } from '../../../constants/pathName'; import { contentLanguageBilingual } from '../../../utils/bilingual'; import { useSelector } from 'react-redux'; import { getUserDetails } from '../../../redux/reducer/userSlice'; -import Cookies from 'js-cookie'; function Calendar({ children, allCalendarsData, setPageNumber }) { const dispatch = useDispatch(); const { user } = useSelector(getUserDetails); - const calendarIdInCookies = Cookies.get('calendarId'); + const calendarIdInCookies = sessionStorage.getItem('calendarId'); const [open, setOpen] = useState(false); const items = allCalendarsData?.data?.map((item) => { @@ -47,7 +46,7 @@ function Calendar({ children, allCalendarsData, setPageNumber }) { const onClick = ({ key }) => { if (calendarIdInCookies != key) { dispatch(setSelectedCalendar(String(key))); - Cookies.set('calendarId', key); + sessionStorage.setItem('calendarId', key); setPageNumber(1); sessionStorage.clear(); setOpen(false); diff --git a/src/pages/Dashboard/Dashboard.jsx b/src/pages/Dashboard/Dashboard.jsx index ccad3c1c6..f46bf66fb 100644 --- a/src/pages/Dashboard/Dashboard.jsx +++ b/src/pages/Dashboard/Dashboard.jsx @@ -79,10 +79,10 @@ function Dashboard() { useEffect(() => { const accessTokenFromCookie = Cookies.get('accessToken'); const refreshTokenFromCookie = Cookies.get('refreshToken'); - const calendarIdFromCookie = Cookies.get('calendarId'); + const calendarIdFromCookie = sessionStorage.getItem('calendarId'); const calId = calendarId || calendarIdFromCookie; - if (calendarId) Cookies.set('calendarId', calId); + if (calendarId) sessionStorage.setItem('calendarId', calId); if (!checkToken(accessToken, accessTokenFromCookie)) navigate(PathName.Login); @@ -111,7 +111,7 @@ function Dashboard() { const checkedCalendarId = findActiveCalendar(); if (checkedCalendarId != null) { - Cookies.set('calendarId', checkedCalendarId); + sessionStorage.setItem('calendarId', checkedCalendarId); } if (calendarId && accessToken) { @@ -130,12 +130,12 @@ function Dashboard() { }); dispatch(setSelectedCalendar(String(calendarId))); } else { - let activeCalendarId = Cookies.get('calendarId'); + let activeCalendarId = sessionStorage.getItem('calendarId'); if (activeCalendarId && accessToken) { navigate(`${PathName.Dashboard}/${activeCalendarId}${PathName.Events}`); } else if (!isLoading && allCalendarsData?.data) { activeCalendarId = allCalendarsData?.data[0]?.id; - Cookies.set('calendarId', activeCalendarId); + sessionStorage.setItem('calendarId', activeCalendarId); navigate(`${PathName.Dashboard}/${activeCalendarId}${PathName.Events}`); } } diff --git a/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx b/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx index cc41ad516..cd6100f55 100644 --- a/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx +++ b/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx @@ -155,7 +155,7 @@ function EventReadOnly() { ['openingHours']: initialPlace[0]?.openingHours?.uri, }; let initialPlaceAccessibiltiy = []; - if (initialPlace[0]?.accessibility?.length > 0) { + if (initialPlace[0]?.accessibility?.length > 0 || initialPlace[0]?.regions?.length > 0) { let taxonomyClassQuery = new URLSearchParams(); taxonomyClassQuery.append('taxonomy-class', taxonomyClass.PLACE); getAllTaxonomy({ @@ -182,6 +182,15 @@ function EventReadOnly() { ...initialPlace[0], ['accessibility']: initialPlaceAccessibiltiy, }; + res?.data?.map((taxonomy) => { + if (taxonomy?.mappedToField == 'Region') { + taxonomy?.concept?.forEach((t) => { + if (initialPlace[0]?.regions[0]?.entityId == t?.id) { + initialPlace[0] = { ...initialPlace[0], regions: [t] }; + } + }); + } + }); setLocationPlace(placesOptions(initialPlace)[0], user, calendarContentLanguage); }) .catch((error) => console.log(error)); @@ -670,6 +679,7 @@ function EventReadOnly() { icon={locationPlace?.label?.props?.icon} name={locationPlace?.name} description={locationPlace?.description} + region={locationPlace?.region} itemWidth="100%" postalAddress={locationPlace?.postalAddress} accessibility={locationPlace?.accessibility} diff --git a/src/pages/Login/Login.jsx b/src/pages/Login/Login.jsx index bf3e906dd..aa798b6c1 100644 --- a/src/pages/Login/Login.jsx +++ b/src/pages/Login/Login.jsx @@ -36,7 +36,7 @@ const Login = () => { }; useEffect(() => { const savedAccessToken = Cookies.get('accessToken'); - const calenderId = Cookies.get('calendarId'); + const calenderId = sessionStorage.getItem('calendarId'); if (location?.state?.previousPath === 'logout') { dispatch(clearUser()); } @@ -50,7 +50,7 @@ const Login = () => { }, []); useEffect(() => { - const calenderId = Cookies.get('calendarId'); + const calenderId = sessionStorage.getItem('calendarId'); if (accessToken && accessToken != '' && calenderId && calenderId != '') { navigate(PathName.Dashboard, { state: { previousPath: 'login' } }); } diff --git a/src/utils/clearSessionStoredSearchQueries.js b/src/utils/clearSessionStoredSearchQueries.js index 3250ed014..33b574eb0 100644 --- a/src/utils/clearSessionStoredSearchQueries.js +++ b/src/utils/clearSessionStoredSearchQueries.js @@ -1,8 +1,12 @@ export const clearSessionStoredSearchQueries = () => { - sessionStorage.removeItem('query'); - sessionStorage.removeItem('queryTaxonomy'); - sessionStorage.removeItem('peopleSearchQuery'); - sessionStorage.removeItem('organizationSearchQuery'); - sessionStorage.removeItem('placesSearchQuery'); - sessionStorage.removeItem('queryUserListing'); + [ + 'query', + 'queryTaxonomy', + 'peopleSearchQuery', + 'organizationSearchQuery', + 'placesSearchQuery', + 'queryUserListing', + ].forEach((key) => { + sessionStorage.removeItem(key); + }); };