From c204f5e6b897a7aa583080649d39eb0bc9c79906 Mon Sep 17 00:00:00 2001 From: Kyle Corbelli Date: Thu, 28 Sep 2017 11:27:39 -0700 Subject: [PATCH] Add SET_HAS_VERIFICATION_BEEN_ATTEMPTED action, reducer and tests --- dist/actions.js | 13 +++++++++++-- dist/actions.js.map | 2 +- dist/reducers/current-user/index.js | 2 ++ dist/reducers/current-user/index.js.map | 2 +- dist/types.js | 1 + dist/types.js.map | 2 +- src/actions.ts | 13 +++++++++++++ src/reducers/current-user/index.test.ts | 14 ++++++++++++++ src/reducers/current-user/index.ts | 6 ++++++ src/types.ts | 11 +++++++++++ 10 files changed, 61 insertions(+), 5 deletions(-) diff --git a/dist/actions.js b/dist/actions.js index 806512d..90029ca 100644 --- a/dist/actions.js +++ b/dist/actions.js @@ -88,6 +88,12 @@ exports.signOutRequestSucceeded = function () { return ({ exports.signOutRequestFailed = function () { return ({ type: types_1.SIGNOUT_REQUEST_FAILED, }); }; +exports.setHasVerificationBeenAttempted = function (hasVerificationBeenAttempted) { return ({ + type: types_1.SET_HAS_VERIFICATION_BEEN_ATTEMPTED, + payload: { + hasVerificationBeenAttempted: hasVerificationBeenAttempted, + }, +}); }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Async Redux Thunk actions: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -263,8 +269,11 @@ var generateAuthActions = function (config) { verificationParams = (_a.uid = (_c.sent()), _a); store.dispatch(verifyToken(verificationParams)); - _c.label = 5; - case 5: return [2 /*return*/]; + return [3 /*break*/, 6]; + case 5: + store.dispatch(exports.setHasVerificationBeenAttempted(true)); + _c.label = 6; + case 6: return [2 /*return*/]; } }); }); }; diff --git a/dist/actions.js.map b/dist/actions.js.map index ddd6b68..ef3e708 100644 --- a/dist/actions.js.map +++ b/dist/actions.js.map @@ -1 +1 @@ -{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,EAAA;;yBAArC,SAAqC,EAArC,wBAAqC;;oBAErC,KAAA,cAAc,CAAA;oBAAE,qBAAM,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,EAAA;;oBAArD,MAAc,IAAE,SAA+C,CAAA;oBACvD,qBAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAA;;oBAAvC,SAAM,IAAE,SAAyC,CAAA;oBAC5C,qBAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAA;;oBAH7B,kBAAkB,IAGtB,MAAG,IAAE,SAAsC,CAAA;2BAC5C;oBACD,KAAK,CAAC,QAAQ,CAAM,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAA;;;oBAEpD,KAAK,CAAC,QAAQ,CAAC,uCAA+B,CAAC,IAAI,CAAC,CAAC,CAAA;;;;;SAExD,CAAA;IAED,MAAM,CAAC;QACL,YAAY,cAAA;QACZ,WAAW,aAAA;QACX,UAAU,YAAA;QACV,WAAW,aAAA;QACX,iBAAiB,mBAAA;KAClB,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/reducers/current-user/index.js b/dist/reducers/current-user/index.js index 8199416..c9dd004 100644 --- a/dist/reducers/current-user/index.js +++ b/dist/reducers/current-user/index.js @@ -38,6 +38,8 @@ var currentUser = function (state, action) { return __assign({}, state, { attributes: allNullUserAttributes, isLoading: false, isSignedIn: false }); case types_1.SIGNOUT_REQUEST_FAILED: return __assign({}, state, { isLoading: false }); + case types_1.SET_HAS_VERIFICATION_BEEN_ATTEMPTED: + return __assign({}, state, { hasVerificationBeenAttempted: action.payload.hasVerificationBeenAttempted }); default: return state; } diff --git a/dist/reducers/current-user/index.js.map b/dist/reducers/current-user/index.js.map index 7c8241b..a06116b 100644 --- a/dist/reducers/current-user/index.js.map +++ b/dist/reducers/current-user/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reducers/current-user/index.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AE,CACH,CAAA;YACD,MAAM,cACD,KAAK,IACR,UAAU,EAAE,qBAAqB,EACjC,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,KAAK,IAClB;QACH,KAAK,8BAAsB;YACzB,MAAM,cACD,KAAK,IACR,SAAS,EAAE,KAAK,IACjB;QACH;YACE,MAAM,CAAC,KAAK,CAAA;IAChB,CAAC;AACH,CAAC,CAAA;AAED,kBAAe,WAAW,CAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reducers/current-user/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qCAiBoB;AACpB,qDAA8C;AAG5C,IAAA,iDAAwB,CACV;AAEhB,IAAM,WAAW,GAAG,UAAC,KAAyB,EAAE,MAAmB;IAA9C,sBAAA,EAAA,mBAAyB;IAC5C,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACpB,KAAK,iCAAyB,CAAC;QAC/B,KAAK,iCAAyB,CAAC;QAC/B,KAAK,2BAAmB,CAAC;QACzB,KAAK,4BAAoB;YACvB,MAAM,cACD,KAAK,IACR,SAAS,EAAE,IAAI,IAChB;QACH,KAAK,sCAA8B;YACjC,MAAM,cACD,KAAK,IACR,UAAU,eAAO,MAAM,CAAC,OAAO,CAAC,cAAc,GAC9C,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,IAAI,EAChB,4BAA4B,EAAE,IAAI,IACnC;QACH,KAAK,sCAA8B,CAAC;QACpC,KAAK,gCAAwB;YAC3B,MAAM,cACD,KAAK,IACR,UAAU,eAAO,MAAM,CAAC,OAAO,CAAC,cAAc,GAC9C,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,IAAI,IACjB;QACH,KAAK,mCAA2B;YAC9B,MAAM,cACD,KAAK,IACR,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,KAAK,EACjB,4BAA4B,EAAE,IAAI,IACnC;QACH,KAAK,mCAA2B,CAAC;QACjC,KAAK,6BAAqB;YACxB,MAAM,cACD,KAAK,IACR,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,KAAK,IAClB;QACH,KAAK,iCAAyB;YAC5B,IAAM,iBAAiB,GAAa,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;YACjE,IAAM,qBAAqB,GAAmB,iBAAiB,CAAC,MAAM,CACpE,UAAC,6BAA6C,EAAE,uBAA+B;gBAC7E,MAAM,cACD,6BAA6B,eAC/B,uBAAuB,IAAG,IAAI,OAChC;;YACH,CAAC,EACD,EAAE,CACH,CAAA;YACD,MAAM,cACD,KAAK,IACR,UAAU,EAAE,qBAAqB,EACjC,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,KAAK,IAClB;QACH,KAAK,8BAAsB;YACzB,MAAM,cACD,KAAK,IACR,SAAS,EAAE,KAAK,IACjB;QACH,KAAK,2CAAmC;YACtC,MAAM,cACD,KAAK,IACR,4BAA4B,EAAE,MAAM,CAAC,OAAO,CAAC,4BAA4B,IAC1E;QACH;YACE,MAAM,CAAC,KAAK,CAAA;IAChB,CAAC;AACH,CAAC,CAAA;AAED,kBAAe,WAAW,CAAA"} \ No newline at end of file diff --git a/dist/types.js b/dist/types.js index a01faf8..cb8675b 100644 --- a/dist/types.js +++ b/dist/types.js @@ -12,4 +12,5 @@ exports.SIGNIN_REQUEST_FAILED = 'redux-token-auth/SIGNIN_REQUEST_FAILED'; exports.SIGNOUT_REQUEST_SENT = 'redux-token-auth/SIGNOUT_REQUEST_SENT'; exports.SIGNOUT_REQUEST_SUCCEEDED = 'redux-token-auth/SIGNOUT_REQUEST_SUCCEEDED'; exports.SIGNOUT_REQUEST_FAILED = 'redux-token-auth/SIGNOUT_REQUEST_FAILED'; +exports.SET_HAS_VERIFICATION_BEEN_ATTEMPTED = 'redux-token-auth/SET_HAS_VERIFICATION_BEEN_ATTEMPTED'; //# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/types.js.map b/dist/types.js.map index 653a0c9..72dd18e 100644 --- a/dist/types.js.map +++ b/dist/types.js.map @@ -1 +1 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;AA+Ca,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,8BAA8B,GAAmC,iDAAiD,CAAA;AAGlH,QAAA,2BAA2B,GAAgC,8CAA8C,CAAA;AAGzG,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,8BAA8B,GAAmC,iDAAiD,CAAA;AAGlH,QAAA,2BAA2B,GAAgC,8CAA8C,CAAA;AAGzG,QAAA,mBAAmB,GAAwB,sCAAsC,CAAA;AAGjF,QAAA,wBAAwB,GAA6B,2CAA2C,CAAA;AAGhG,QAAA,qBAAqB,GAA0B,wCAAwC,CAAA;AAGvF,QAAA,oBAAoB,GAAyB,uCAAuC,CAAA;AAGpF,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,sBAAsB,GAA2B,yCAAyC,CAAA"} \ No newline at end of file +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;AA+Ca,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,8BAA8B,GAAmC,iDAAiD,CAAA;AAGlH,QAAA,2BAA2B,GAAgC,8CAA8C,CAAA;AAGzG,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,8BAA8B,GAAmC,iDAAiD,CAAA;AAGlH,QAAA,2BAA2B,GAAgC,8CAA8C,CAAA;AAGzG,QAAA,mBAAmB,GAAwB,sCAAsC,CAAA;AAGjF,QAAA,wBAAwB,GAA6B,2CAA2C,CAAA;AAGhG,QAAA,qBAAqB,GAA0B,wCAAwC,CAAA;AAGvF,QAAA,oBAAoB,GAAyB,uCAAuC,CAAA;AAGpF,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,sBAAsB,GAA2B,yCAAyC,CAAA;AAG1F,QAAA,mCAAmC,GAAwC,sDAAsD,CAAA"} \ No newline at end of file diff --git a/src/actions.ts b/src/actions.ts index 818cdae..b19b084 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -24,6 +24,7 @@ import { SIGNOUT_REQUEST_SENT, SIGNOUT_REQUEST_SUCCEEDED, SIGNOUT_REQUEST_FAILED, + SET_HAS_VERIFICATION_BEEN_ATTEMPTED, RegistrationRequestSentAction, RegistrationRequestSucceededAction, RegistrationRequestFailedAction, @@ -36,6 +37,7 @@ import { SignOutRequestSentAction, SignOutRequestSucceededAction, SignOutRequestFailedAction, + SetHasVerificationBeenAttemptedAction, } from './types' import AsyncLocalStorage from './AsyncLocalStorage' import { @@ -107,6 +109,15 @@ export const signOutRequestFailed = (): SignOutRequestFailedAction => ({ type: SIGNOUT_REQUEST_FAILED, }) +export const setHasVerificationBeenAttempted = ( + hasVerificationBeenAttempted: boolean +): SetHasVerificationBeenAttemptedAction => ({ + type: SET_HAS_VERIFICATION_BEEN_ATTEMPTED, + payload: { + hasVerificationBeenAttempted, + }, +}) + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Async Redux Thunk actions: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -231,6 +242,8 @@ const generateAuthActions = (config: { [key: string]: any }): ActionsExport => { uid: await Storage.getItem('uid') as string, } store.dispatch(verifyToken(verificationParams)) + } else { + store.dispatch(setHasVerificationBeenAttempted(true)) } } diff --git a/src/reducers/current-user/index.test.ts b/src/reducers/current-user/index.test.ts index beb147c..2341874 100644 --- a/src/reducers/current-user/index.test.ts +++ b/src/reducers/current-user/index.test.ts @@ -14,6 +14,7 @@ import { SignOutRequestFailedAction, User, UserAttributes, + SetHasVerificationBeenAttemptedAction, } from '../../types' import { registrationRequestSent, @@ -28,6 +29,7 @@ import { signOutRequestSent, signOutRequestSucceeded, signOutRequestFailed, + setHasVerificationBeenAttempted, } from '../../actions' describe('currentUser', () => { @@ -197,4 +199,16 @@ describe('currentUser', () => { expect(newState).toEqual(expectedNewState) }) }) + + describe('SET_HAS_VERIFICATION_BEEN_ATTEMPTED', () => { + it('sets hasVerificationBeenAttempted', () => { + const action: SetHasVerificationBeenAttemptedAction = setHasVerificationBeenAttempted(true) + const initialState: User = { + ...alreadyLoadingState, + hasVerificationBeenAttempted: false, + } + const newState: User = currentUser(alreadyLoadingState, action) + expect(newState.hasVerificationBeenAttempted).toBe(true) + }) + }) }) diff --git a/src/reducers/current-user/index.ts b/src/reducers/current-user/index.ts index 5bb1463..49f9ce9 100644 --- a/src/reducers/current-user/index.ts +++ b/src/reducers/current-user/index.ts @@ -14,6 +14,7 @@ import { SIGNOUT_REQUEST_SENT, SIGNOUT_REQUEST_SUCCEEDED, SIGNOUT_REQUEST_FAILED, + SET_HAS_VERIFICATION_BEEN_ATTEMPTED, } from '../../types' import initialState from '../../initial-state' @@ -83,6 +84,11 @@ const currentUser = (state: User = initialUser, action: ReduxAction): User => { ...state, isLoading: false, } + case SET_HAS_VERIFICATION_BEEN_ATTEMPTED: + return { + ...state, + hasVerificationBeenAttempted: action.payload.hasVerificationBeenAttempted, + } default: return state } diff --git a/src/types.ts b/src/types.ts index bd0a90e..fdfd2a6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -80,6 +80,9 @@ export const SIGNOUT_REQUEST_SUCCEEDED: SIGNOUT_REQUEST_SUCCEEDED = 'redux-token export type SIGNOUT_REQUEST_FAILED = 'redux-token-auth/SIGNOUT_REQUEST_FAILED' export const SIGNOUT_REQUEST_FAILED: SIGNOUT_REQUEST_FAILED = 'redux-token-auth/SIGNOUT_REQUEST_FAILED' +export type SET_HAS_VERIFICATION_BEEN_ATTEMPTED = 'redux-token-auth/SET_HAS_VERIFICATION_BEEN_ATTEMPTED' +export const SET_HAS_VERIFICATION_BEEN_ATTEMPTED: SET_HAS_VERIFICATION_BEEN_ATTEMPTED = 'redux-token-auth/SET_HAS_VERIFICATION_BEEN_ATTEMPTED' + export interface UserRegistrationDetails { readonly email: string readonly password: string @@ -155,6 +158,13 @@ export interface SignOutRequestFailedAction { readonly type: SIGNOUT_REQUEST_FAILED } +export interface SetHasVerificationBeenAttemptedAction { + readonly type: SET_HAS_VERIFICATION_BEEN_ATTEMPTED + readonly payload: { + readonly hasVerificationBeenAttempted: boolean + } +} + export type ReduxAction = RegistrationRequestSentAction | RegistrationRequestSucceededAction | RegistrationRequestFailedAction @@ -167,6 +177,7 @@ export type ReduxAction = RegistrationRequestSentAction | SignOutRequestSentAction | SignOutRequestSucceededAction | SignOutRequestFailedAction + | SetHasVerificationBeenAttemptedAction export type ReduxAsyncAction = (input?: any) => (dispatch: Dispatch<{}>) => Promise