2017-08-18 21:30:16 +00:00
|
|
|
import { put, takeEvery } from 'redux-saga/effects';
|
|
|
|
|
|
|
|
import { SERVER } from '../actions/actionsTypes';
|
|
|
|
import { connectRequest, disconnect } from '../actions/connect';
|
|
|
|
import { changedServer } from '../actions/server';
|
|
|
|
|
|
|
|
const selectServer = function* selectServer(server) {
|
2017-08-21 00:11:46 +00:00
|
|
|
yield put(disconnect());
|
|
|
|
yield put(changedServer(server));
|
|
|
|
yield put(connectRequest(server));
|
2017-08-18 21:30:16 +00:00
|
|
|
};
|
|
|
|
const root = function* root() {
|
|
|
|
yield takeEvery(SERVER.SELECT, selectServer);
|
|
|
|
};
|
|
|
|
export default root;
|