2017-08-17 02:06:22 +00:00
|
|
|
import * as types from '../actions/actionsTypes';
|
|
|
|
|
|
|
|
const initialState = {
|
|
|
|
isFetching: false,
|
2017-12-08 19:13:21 +00:00
|
|
|
failure: false,
|
|
|
|
searchText: ''
|
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,
|
2017-08-17 02:06:22 +00:00
|
|
|
isFetching: true
|
|
|
|
};
|
|
|
|
case types.ROOMS.SUCCESS:
|
2017-11-13 12:58:35 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2017-08-17 02:06:22 +00:00
|
|
|
isFetching: false
|
|
|
|
};
|
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,
|
|
|
|
failure: true,
|
|
|
|
errorMessage: action.err
|
|
|
|
};
|
2017-12-08 19:13:21 +00:00
|
|
|
case types.ROOMS.SET_SEARCH:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
searchText: action.searchText
|
|
|
|
};
|
2017-08-17 02:06:22 +00:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|