parent
cf253b482a
commit
7657952e1f
@ -0,0 +1,8 @@
|
||||
import {FETCH_VILLES} from '../constants';
|
||||
|
||||
export const setVilleCherchee = (nomVille: string)=>{
|
||||
return {
|
||||
type: FETCH_VILLES,
|
||||
payload: nomVille,
|
||||
};
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
const initialState = {
|
||||
villes: [],
|
||||
}
|
||||
|
||||
export default villeRechercheReducer = (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
case FETCH_VILLES:
|
||||
return {...state, villes: state.villes.push(action.payload)};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
const initialState = {
|
||||
villes: [],
|
||||
}
|
||||
|
||||
export default appReducer = (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
case FETCH_VILLE:
|
||||
// @ts-ignore
|
||||
return {...state, villes: action.payload};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
import {configureStore} from '@reduxjs/toolkit'
|
||||
import appReducer from './reducers/appReducer';
|
||||
import VilleRechercheReducer from './reducers/VilleRechercheReducer';
|
||||
|
||||
// Reference here all your application reducers
|
||||
const reducerVille = {
|
||||
const reducer = {
|
||||
appReducer: appReducer,
|
||||
VilleRechercheReducer: VilleRechercheReducer,
|
||||
}
|
||||
|
||||
// @ts-ignore
|
Loading…
Reference in new issue