diff --git a/redux/reducers/appReducer.ts b/redux/reducers/appReducer.ts index fd5e7c5..ca80c79 100644 --- a/redux/reducers/appReducer.ts +++ b/redux/reducers/appReducer.ts @@ -1,4 +1,4 @@ -import {CITIES_DATA, FAVORITE_CITY_DATA, WEATHER_DATA } from '../constants'; +import {CITIES_DATA, FAVORITE_CITY_DATA, FETCH_WEATHER_API, RECHERCHER_VILLES, RECUPERER_METEO, RECUPERER_VILLES, WEATHER_DATA } from '../constants'; const initialState = { meteo: WEATHER_DATA, @@ -7,7 +7,7 @@ const initialState = { //@ts-ignore export default appReducer = (state = initialState, action) => { - switch (action.type) {/* + switch (action.type) { case FETCH_WEATHER_API: return {...state, meteo: action.payload}; case RECHERCHER_VILLES: @@ -15,7 +15,7 @@ export default appReducer = (state = initialState, action) => { case RECUPERER_METEO: return {...state, meteo: action.payload}; case RECUPERER_VILLES: - return {...state, villes: action.payload};*/ + return {...state, villes: action.payload}; default: return state; } diff --git a/src/screen/AddCity.tsx b/src/screen/AddCity.tsx index 4032a20..4a7f017 100644 --- a/src/screen/AddCity.tsx +++ b/src/screen/AddCity.tsx @@ -1,13 +1,19 @@ import { useState } from 'react'; import { FlatList, Button, StyleSheet, Text, View, TextInput, Image } from 'react-native'; +import { getCityApi } from '../../redux/fonctionsThunk'; import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather } from '../../data/stub'; import CityListItem from '../components/CityListItem'; +import { useSelector } from 'react-redux'; export default function AddCity() { + //@ts-ignore + const nList = useSelector(state => state.appReducer.cities); + + return (