Created
August 31, 2020 21:59
-
-
Save lakshaygupta21/7a1b26e0cf92b432ed0098ec12d87e69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initialState = { | |
result: [ | |
[] | |
], | |
sending: false, | |
keyArr: [], | |
dailyTrending: false | |
}; | |
export default function(state = initialState, action) { | |
const { | |
type, | |
payload | |
} = action; | |
switch (type) { | |
case 'SENDING': | |
return { | |
...state, | |
sending: true | |
} | |
case 'TREND_RECEIVED': | |
return { | |
...state, | |
sending: false, | |
result: payload | |
} | |
case 'TREND_ERROR': | |
return { | |
...state, | |
sending: false | |
} | |
case 'TRENDING': | |
return { | |
...state, | |
dailyTrending: true | |
} | |
case 'TRENDING_RECEIVED': | |
return { | |
...state, | |
dailyTrending: false, | |
keyArr: payload | |
} | |
case 'TRENDING_ERROR': | |
return { | |
...state, | |
dailyTrending: false | |
} | |
default: | |
return state | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment