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

27 lines
461 B
JavaScript

import { METEOR } from '../actions/actionsTypes';
const initialState = {
connecting: false,
connected: false
};
export default function connect(state = initialState, action) {
switch (action.type) {
case METEOR.REQUEST:
return {
...state,
connecting: true
};
case METEOR.SUCCESS:
return {
...state,
connecting: false,
connected: true
};
case METEOR.DISCONNECT:
return initialState;
default:
return state;
}
}