2017-09-01 19:42:50 +00:00
|
|
|
import { CREATE_CHANNEL } from '../actions/actionsTypes';
|
|
|
|
|
|
|
|
const initialState = {
|
|
|
|
isFetching: false,
|
2017-09-25 13:15:28 +00:00
|
|
|
failure: false,
|
2018-10-23 21:39:48 +00:00
|
|
|
result: {},
|
|
|
|
error: {}
|
2017-09-01 19:42:50 +00:00
|
|
|
};
|
|
|
|
|
2019-10-07 20:56:30 +00:00
|
|
|
export default function(state = initialState, action) {
|
2017-09-01 19:42:50 +00:00
|
|
|
switch (action.type) {
|
|
|
|
case CREATE_CHANNEL.REQUEST:
|
2017-09-25 13:15:28 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2018-04-24 19:34:03 +00:00
|
|
|
isFetching: true,
|
2017-09-01 19:42:50 +00:00
|
|
|
failure: false,
|
2018-10-23 21:39:48 +00:00
|
|
|
error: {}
|
2017-09-01 19:42:50 +00:00
|
|
|
};
|
|
|
|
case CREATE_CHANNEL.SUCCESS:
|
2017-09-25 13:15:28 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2017-09-01 19:42:50 +00:00
|
|
|
isFetching: false,
|
|
|
|
failure: false,
|
|
|
|
result: action.data
|
|
|
|
};
|
|
|
|
case CREATE_CHANNEL.FAILURE:
|
2017-09-25 13:15:28 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2017-09-01 19:42:50 +00:00
|
|
|
isFetching: false,
|
|
|
|
failure: true,
|
|
|
|
error: action.err
|
|
|
|
};
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|