Initial commit
This commit is contained in:
21
client/src/sagas/login/index.js
Executable file
21
client/src/sagas/login/index.js
Executable file
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
all, call, cancel, fork, take,
|
||||
} from 'redux-saga/effects';
|
||||
|
||||
import watchers from './watchers';
|
||||
import { goToRootService } from './services';
|
||||
import { setAccessToken } from '../../utils/access-token-storage';
|
||||
import ActionTypes from '../../constants/ActionTypes';
|
||||
|
||||
export default function* () {
|
||||
const watcherTasks = yield all(watchers.map((watcher) => fork(watcher)));
|
||||
|
||||
const {
|
||||
payload: { accessToken },
|
||||
} = yield take(ActionTypes.AUTHENTICATE_SUCCEEDED);
|
||||
|
||||
yield cancel(watcherTasks);
|
||||
|
||||
yield call(setAccessToken, accessToken);
|
||||
yield call(goToRootService);
|
||||
}
|
||||
Reference in New Issue
Block a user