aws-cognito-redux-saga-refact
Advanced tools
Comparing version
{ | ||
"name": "aws-cognito-redux-saga-refact", | ||
"version": "1.5.18", | ||
"version": "1.5.19", | ||
"description": "Redux Saga AWS Cognito Library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -6,2 +6,3 @@ export const AUTH_INIT = 'AUTH_INIT' | ||
export const AUTH_SIGN_IN = 'AUTH_SIGN_IN' | ||
export const AUTH_CONFIRMATION = 'AUTH_CONFIRMATION' | ||
export const AUTH_SIGN_OUT = 'AUTH_SIGN_OUT' | ||
@@ -8,0 +9,0 @@ export const AUTH_FORGOT_PASSWORD = 'AUTH_FORGOT_PASSWORD' |
@@ -28,2 +28,12 @@ import * as action from './actions' | ||
export const confirmation = (username, code) => { | ||
return { | ||
type: action.AUTH_CONFIRMATION, | ||
payload: { | ||
username, | ||
code | ||
} | ||
} | ||
} | ||
export const signIn = (username, password, code) => { | ||
@@ -30,0 +40,0 @@ return { |
@@ -89,2 +89,22 @@ import * as auth from 'aws-cognito-promises-refact' | ||
function* confirmation(action) { | ||
try { | ||
const { username, code } = action.payload | ||
yield call(auth.confirmation, username, code) | ||
yield put({ | ||
type: actions.AUTH_SET_STATE, | ||
payload: { | ||
isConfirmed: states.AUTH_SUCCESS, | ||
} | ||
}) | ||
} catch (e) { | ||
yield put({ | ||
type: actions.AUTH_SET_STATE, | ||
payload: { isConfirmed: states.AUTH_FAIL, error: e } | ||
}) | ||
} | ||
} | ||
function* signIn(action) { | ||
@@ -204,2 +224,3 @@ let user = null; | ||
yield takeLatest(actions.AUTH_SIGN_UP, signUp) | ||
yield takeLatest(actions.AUTH_CONFIRMATION, confirmation) | ||
yield takeLatest(actions.AUTH_SIGN_IN, signIn) | ||
@@ -206,0 +227,0 @@ yield takeLatest(actions.AUTH_SIGN_OUT, signOut) |
Sorry, the diff of this file is too big to display
306409
0.46%777
4.16%