From 7dddebb8d78e707268fcd65f473b9d430b4c4d32 Mon Sep 17 00:00:00 2001 From: Mike Ryan Date: Sat, 28 Mar 2020 20:21:11 -0500 Subject: [PATCH] 18-handling-auth-api-actions --- src/app/shared/state/auth.reducer.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/app/shared/state/auth.reducer.ts b/src/app/shared/state/auth.reducer.ts index 7c5b6d4..065b55d 100644 --- a/src/app/shared/state/auth.reducer.ts +++ b/src/app/shared/state/auth.reducer.ts @@ -29,6 +29,27 @@ export const authReducer = createReducer( user: null, error: null }; + }), + on(AuthApiActions.getAuthStatusSuccess, (state, action) => { + return { + gettingStatus: false, + user: action.user, + error: null + }; + }), + on(AuthApiActions.loginSuccess, (state, action) => { + return { + gettingStatus: false, + user: action.user, + error: null + }; + }), + on(AuthApiActions.loginFailure, (state, action) => { + return { + gettingStatus: false, + user: null, + error: action.reason + }; }) );