2017-08-17 02:06:22 +00:00
|
|
|
import * as types from '../actions/actionsTypes';
|
|
|
|
|
|
|
|
const initialState = {
|
2019-02-12 16:14:11 +00:00
|
|
|
isFetching: false,
|
2020-02-19 19:43:47 +00:00
|
|
|
refreshing: false,
|
2017-12-08 19:13:21 +00:00
|
|
|
failure: false,
|
2019-02-07 16:13:21 +00:00
|
|
|
errorMessage: {},
|
2018-08-31 16:46:33 +00:00
|
|
|
searchText: '',
|
|
|
|
showServerDropdown: false,
|
|
|
|
closeServerDropdown: false,
|
2018-10-23 21:39:48 +00:00
|
|
|
showSortDropdown: false,
|
|
|
|
showSearchHeader: false
|
2017-08-17 02:06:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function login(state = initialState, action) {
|
|
|
|
switch (action.type) {
|
|
|
|
case types.ROOMS.REQUEST:
|
2017-11-13 12:58:35 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2019-02-07 16:13:21 +00:00
|
|
|
isFetching: true,
|
|
|
|
failure: false,
|
|
|
|
errorMessage: {}
|
2017-08-17 02:06:22 +00:00
|
|
|
};
|
|
|
|
case types.ROOMS.SUCCESS:
|
2017-11-13 12:58:35 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2020-02-19 19:43:47 +00:00
|
|
|
isFetching: false,
|
|
|
|
refreshing: false
|
2017-08-17 02:06:22 +00:00
|
|
|
};
|
2017-08-17 06:28:41 +00:00
|
|
|
case types.ROOMS.FAILURE:
|
2017-11-13 12:58:35 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2017-08-17 02:06:22 +00:00
|
|
|
isFetching: false,
|
2020-02-19 19:43:47 +00:00
|
|
|
refreshing: false,
|
2017-08-17 02:06:22 +00:00
|
|
|
failure: true,
|
|
|
|
errorMessage: action.err
|
|
|
|
};
|
2020-02-19 19:43:47 +00:00
|
|
|
case types.ROOMS.REFRESH:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
isFetching: true,
|
|
|
|
refreshing: true
|
|
|
|
};
|
2017-12-08 19:13:21 +00:00
|
|
|
case types.ROOMS.SET_SEARCH:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
searchText: action.searchText
|
|
|
|
};
|
2018-08-31 16:46:33 +00:00
|
|
|
case types.ROOMS.CLOSE_SERVER_DROPDOWN:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
closeServerDropdown: !state.closeServerDropdown
|
|
|
|
};
|
|
|
|
case types.ROOMS.TOGGLE_SERVER_DROPDOWN:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
showServerDropdown: !state.showServerDropdown
|
|
|
|
};
|
|
|
|
case types.ROOMS.CLOSE_SORT_DROPDOWN:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
closeSortDropdown: !state.closeSortDropdown
|
|
|
|
};
|
|
|
|
case types.ROOMS.TOGGLE_SORT_DROPDOWN:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
showSortDropdown: !state.showSortDropdown
|
|
|
|
};
|
2018-10-23 21:39:48 +00:00
|
|
|
case types.ROOMS.OPEN_SEARCH_HEADER:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
showSearchHeader: true
|
|
|
|
};
|
|
|
|
case types.ROOMS.CLOSE_SEARCH_HEADER:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
showSearchHeader: false
|
|
|
|
};
|
2017-08-17 02:06:22 +00:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|