[ABANDONED] React/Redux front end for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

36 lines
898 B

import { Reducer } from 'redux'
import { GroupsActions } from '../actions/groups'
import { GroupsState } from '../types'
const initialState: GroupsState = {
groups: [],
continuation: undefined,
}
const reducer: Reducer<GroupsState, GroupsActions> = (state = initialState, action) => {
switch (action.type) {
case 'GROUPS_SET_GROUPS':
return {
...state,
groups: action.payload,
}
case 'GROUPS_APPEND_GROUPS':
return {
...state,
groups: [
...state.groups,
...action.payload,
],
}
case 'GROUPS_SET_CONTINUATION':
return {
...state,
continuation: action.payload,
}
default:
return state
}
}
export default reducer