Compare commits

..

No commits in common. "d3cded434439933908db8c1c4768dd2b67bfc57f" and "cf9dd8a3d1391588c5a24577e14fa250ff675f89" have entirely different histories.

3 changed files with 3 additions and 7 deletions

View File

@ -1,8 +1,5 @@
import { useWeatherStore } from "@/store/weatherStore";
import { Cloud } from "lucide-react";
import {WeatherDisplay } from '@/components/WeatherDisplay'
import { WeatherSearchForm } from "./WeatherSearchForm";
import { WeatherDetailsGrid } from "./WeatherDetailsGird";
export function WeatherCard(){
const{ currentWeather} = useWeatherStore();

View File

@ -7,7 +7,7 @@ import { useWeatherStore } from '@/store/weatherStore';
export function WeatherSearchForm() {
const {isLoading, currentWeather, searchWeather, refreshWeather} = useWeatherStore();
const [isLoading, currentWeather, searchWeather, refreshWeather] = useWeatherStore();
const [city, setCity] = useState('');
const [inputError, setInputError] = useState('');

View File

@ -1,6 +1,5 @@
import { create } from 'zustand'
import {persist,createJSONStorage} from 'zustand/middleware'
import { WeatherApi } from '@/services/weatherApi';
const CACHE_EXPIRY = 10 * 60 * 1000;
export interface Location {
@ -99,7 +98,7 @@ export const useWeatherStore = create<WeatherStore>()(
set({currentWeather:cachedWeather,isLoading:false});
return;
}
const WeatherData = await WeatherApi.getCurrentWeather(city);
const WeatherData = await WeatherAPI.getcurrentWeather(city);
set({currentWeather:WeatherData,isLoading:false});
get().cacheWeather(city,WeatherData);
}catch(error){
@ -112,7 +111,7 @@ export const useWeatherStore = create<WeatherStore>()(
try{
set({isLoading:true,error:null});
const city = currentWeather.location.name;
const WeatherData = await WeatherApi.getCurrentWeather(city);
const WeatherData = await WeatherAPI.getcurrentWeather(city);
set({currentWeather:WeatherData,isLoading:false});
get().cacheWeather(city,WeatherData);
}catch(error){