From 7906ded0616aac733ab0795aa6e29e1fdf3279c2 Mon Sep 17 00:00:00 2001 From: tanhengyeow Date: Thu, 11 Jun 2020 02:36:44 +0800 Subject: Update reducers folder --- frontend/src/reducers/index.tsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 frontend/src/reducers/index.tsx diff --git a/frontend/src/reducers/index.tsx b/frontend/src/reducers/index.tsx new file mode 100644 index 00000000..76e2d0c0 --- /dev/null +++ b/frontend/src/reducers/index.tsx @@ -0,0 +1,22 @@ +import { Authenticate, Unauthenticate } from '../actions/auth'; +import { AUTHENTICATE, UNAUTHENTICATE } from '../constants'; +import { Store } from '../types'; + +export default function rootReducer( + state: Store = { + isAuthenticated: false, + }, + action: Authenticate | Unauthenticate +): Store { + switch (action.type) { + case AUTHENTICATE: + return { + ...state, + isAuthenticated: true, + }; + case UNAUTHENTICATE: + return { ...state, isAuthenticated: false }; + default: + return state; + } +} -- cgit v1.2.3