Rocket.Chat.ReactNative/app/reducers/connect.js

28 lines
483 B
JavaScript
Raw Normal View History

2017-08-17 01:06:31 +00:00
import { METEOR } from '../actions/actionsTypes';
const initialState = {
connecting: false,
2018-12-05 20:52:08 +00:00
connected: false
2017-08-17 01:06:31 +00:00
};
export default function connect(state = initialState, action) {
switch (action.type) {
case METEOR.REQUEST:
2017-11-13 12:58:35 +00:00
return {
...state,
connecting: true,
connected: false
2017-08-17 01:06:31 +00:00
};
case METEOR.SUCCESS:
2017-11-13 12:58:35 +00:00
return {
...state,
2017-08-17 01:06:31 +00:00
connecting: false,
2018-12-05 20:52:08 +00:00
connected: true
};
2017-08-17 16:55:47 +00:00
case METEOR.DISCONNECT:
return initialState;
2017-08-17 01:06:31 +00:00
default:
return state;
}
}