|
| 1 | +// |
| 2 | +// export const initialState = { |
| 3 | +// } |
| 4 | +// |
| 5 | +// const reducer = ()=>{ |
| 6 | +// } |
| 7 | +// |
| 8 | +// export default reducer; |
| 9 | +// |
| 10 | +// //Task List: |
| 11 | +// //1. Adds the following state values into the initialState: |
| 12 | +// // - an array of smurfs |
| 13 | +// // - a boolean indicating if the app is loading |
| 14 | +// // - a string indicating a possible error message |
| 15 | +// |
| 16 | +// //2. Add in the arguments needed to complete a standard reducer function. |
| 17 | +// //3. Add in a reducer case to accomidate the start of a smurf fetch. |
| 18 | +// //4. Add in a reducer case to accomidate the successful smurf api fetch. |
| 19 | +// //5. Add in a reducer cases to accomidate the failed smurf api fetch. |
| 20 | +// //6. Add in a reducer case to accomidate adding a smurf (including the name, nickname, position, summary and an internally generated id) into your smurf list. |
| 21 | +// //7. Add in a reducer case that adds in a value to the error message. |
1 | 22 |
|
2 |
| -export const initialState = { |
3 |
| -} |
4 |
| - |
5 |
| -const reducer = ()=>{ |
6 |
| -} |
7 | 23 |
|
8 |
| -export default reducer; |
9 | 24 |
|
10 |
| -//Task List: |
11 |
| -//1. Adds the following state values into the initialState: |
12 |
| -// - an array of smurfs |
13 |
| -// - a boolean indicating if the app is loading |
14 |
| -// - a string indicating a possible error message |
| 25 | +import FETCH_START from '../actions/index' |
| 26 | +import ADD_SMURF from '../actions/index' |
| 27 | +import FETCH_SUCCESS from '../actions/index' |
| 28 | +import SET_ERROR from '../actions/index' |
| 29 | +import FETCH_FAIL from '../actions/index' |
15 | 30 |
|
16 |
| -//2. Add in the arguments needed to complete a standard reducer function. |
17 |
| -//3. Add in a reducer case to accomidate the start of a smurf fetch. |
18 |
| -//4. Add in a reducer case to accomidate the successful smurf api fetch. |
19 |
| -//5. Add in a reducer cases to accomidate the failed smurf api fetch. |
20 |
| -//6. Add in a reducer case to accomidate adding a smurf (including the name, nickname, position, summary and an internally generated id) into your smurf list. |
21 |
| -//7. Add in a reducer case that adds in a value to the error message. |
| 31 | +export const initialState = { |
| 32 | + smurfsArray: [], |
| 33 | + appLoading: false, |
| 34 | + error: '' |
| 35 | +} |
0 commit comments