summaryrefslogtreecommitdiff
path: root/frontend/src/reducers/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/reducers/index.tsx')
-rw-r--r--frontend/src/reducers/index.tsx22
1 files changed, 22 insertions, 0 deletions
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;
+ }
+}