diff --git a/src/redux/auth/sagas.ts b/src/redux/auth/sagas.ts index 9805d638..7b59aa3e 100644 --- a/src/redux/auth/sagas.ts +++ b/src/redux/auth/sagas.ts @@ -4,26 +4,22 @@ import {AUTH_USER_ACTIONS} from "~/redux/auth/constants"; import * as ActionCreators from '~/redux/auth/actions'; import {authSetToken, userSetLoginError} from "~/redux/auth/actions"; import {apiUserLogin} from "~/redux/auth/api"; +import {modalSetShown} from "~/redux/modal/actions"; function* sendLoginRequestSaga({ username, password }: ReturnType): SagaIterator { if (!username || !password) return; - const { error, data: { access, refresh, user }} = yield call(apiUserLogin, { username, password }); + const { error, data: { access, refresh }} = yield call(apiUserLogin, { username, password }); - console.log({ access, refresh, user, error }); + console.log({ access, refresh, error }); if (error) return yield put(userSetLoginError(error)); yield put(authSetToken({ access, refresh })); - // const { token, status, user }: - // { token: string, status: number, user: IApiUser } = yield call(apiUserLogin, { username, password }); - // - // if (!token) return yield put(userSetLoginError({ error: USER_STATUSES[status] || USER_ERRORS.INVALID_CREDENTIALS })); - // - // const { id, role, email, activated: is_activated } = user; - // - // yield put(userSetUser({ token, id, role, email, username: user.username, is_activated, is_user: true })); - // yield put(push('/')); + + // todo: get /auth/me + + yield put(modalSetShown(false)); } function* mySaga() {