chore(client): Move client app to /client
This commit is contained in:
committed by
mrugesh mohapatra
parent
0e4f588a1c
commit
e59ad6ebda
24
client/src/redux/fetch-user-saga.js
Normal file
24
client/src/redux/fetch-user-saga.js
Normal file
@ -0,0 +1,24 @@
|
||||
import { call, put, takeEvery } from 'redux-saga/effects';
|
||||
|
||||
import { fetchUserComplete, fetchUserError } from './';
|
||||
import { getSessionUser } from '../utils/ajax';
|
||||
|
||||
function* fetchSessionUser() {
|
||||
console.log('fetchSessionUser');
|
||||
try {
|
||||
const {
|
||||
data: {
|
||||
user = {},
|
||||
result = ''
|
||||
}
|
||||
} = yield call(getSessionUser);
|
||||
const appUser = user[result];
|
||||
yield put(fetchUserComplete({ user: appUser, username: result }));
|
||||
} catch (e) {
|
||||
yield put(fetchUserError(e));
|
||||
}
|
||||
}
|
||||
|
||||
export function createFetchUserSaga(types) {
|
||||
return [takeEvery(types.fetchUser, fetchSessionUser)];
|
||||
}
|
Reference in New Issue
Block a user