Added localstorage data

This commit is contained in:
Sean Edmunds
2025-01-31 15:16:42 -06:00
parent 9430db990b
commit cc46bb0402
5 changed files with 72 additions and 56 deletions

View File

@@ -3,37 +3,33 @@ import { modalClasses } from 'styles';
import SmallOutlookCard from './SmallOutlookCard';
import SmallWeatherCard from './SmallWeatherCard';
import { useCommonHooks, useQueryAPI, useWeatherAPI } from 'hooks';
import { useCommonHooks, useWeatherAPI } from 'hooks';
import { useEffect, useState } from 'react';
import HourlyCard from './HourlyCard';
export function WeatherModal({
current,
outlook,
points,
closeWeatherModal,
weatherModalOpened,
}: any) {
const { data: personalData, isFetched: personalIsFetched } = useQueryAPI({
endpoint: 'api/personalData',
});
const {
theme,
isMobile,
setProviderLabel,
setSearchValue,
setProviderURL,
currentUser,
currentLocation,
} = useCommonHooks();
const { data: hourly } = useWeatherAPI({
endpoint: 'hourly',
office: points?.properties.gridId,
x: points?.properties.gridX,
y: points?.properties.gridY,
office: currentLocation.office,
x: currentLocation.x,
y: currentLocation.y,
});
const [personal, setPersonal] = useState<any>([]);
const [hourlyForecast, setHourlyForecast] = useState<any>([]);
const [sunset, setSunset] = useState(100);
const { theme, isMobile, setProviderLabel, setSearchValue, setProviderURL } =
useCommonHooks();
useEffect(() => {
if (personalData && personalIsFetched) {
setPersonal(personalData);
}
}, [personalData, personalIsFetched]);
useEffect(() => {
if (hourly) {
@@ -87,7 +83,7 @@ export function WeatherModal({
Weather Forecast for{' '}
</Text>
<Text fz={18} fw={600}>
{personal?.[0]?.physicalAddress}
{currentUser.physicalAddress}
</Text>
</Group>
</Modal.Title>