(bugfixes)

This commit is contained in:
muerwre 2018-12-06 13:19:22 +07:00
parent 3d718b5a2c
commit b8431abeeb
13 changed files with 1228 additions and 1057 deletions

View file

@ -43,3 +43,6 @@ export const setProvider = provider => ({ type: ACTIONS.SET_PROVIDER, provider }
export const setDialog = ({ dialog, dialog_active }) => ({ type: ACTIONS.SET_DIALOG, dialog });
export const locationChanged = location => ({ type: ACTIONS.LOCATION_CHANGED, location });
export const setReady = ready => ({ type: ACTIONS.SET_READY, ready });
export const gotVkUser = user => ({ type: ACTIONS.GOT_VK_USER, user });

View file

@ -44,4 +44,6 @@ export const ACTIONS = ({
SET_DIALOG: 'SET_DIALOG',
LOCATION_CHANGED: 'LOCATION_CHANGED',
SET_READY: 'SET_READY',
GOT_VK_USER: 'GOT_VK_USER',
}: { [key: String]: String });

View file

@ -137,7 +137,7 @@ function* mapInitSaga() {
return true;
}
function* authChechSaga() {
function* authCheckSaga() {
const { id, token } = yield select(getUser);
if (id && token) {
@ -351,8 +351,14 @@ function* locationChangeSaga({ location }) {
}
}
function* gotVkUserSaga({ user }) {
const data = yield call(checkUserToken, user);
yield put(setUser(data));
}
export function* userSaga() {
yield takeLatest(REHYDRATE, authChechSaga);
yield takeLatest(REHYDRATE, authCheckSaga);
yield takeEvery(ACTIONS.SET_MODE, setModeSaga);
yield takeEvery(ACTIONS.START_EDITING, startEditingSaga);
@ -378,4 +384,6 @@ export function* userSaga() {
yield takeEvery(ACTIONS.SET_PROVIDER, setProviderSaga);
yield takeLatest(ACTIONS.LOCATION_CHANGED, locationChangeSaga);
yield takeLatest(ACTIONS.GOT_VK_USER, gotVkUserSaga);
}