From 3902da1747a3e32db0b67f1162eafd4860b3d27a Mon Sep 17 00:00:00 2001
From: Joseph Ditton <jditton.atomic@gmail.com>
Date: Sat, 20 Nov 2021 19:34:10 -0700
Subject: working on signup implementation

---
 client/app.jsx | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

(limited to 'client/app.jsx')

diff --git a/client/app.jsx b/client/app.jsx
index 5ae62df..6414fad 100644
--- a/client/app.jsx
+++ b/client/app.jsx
@@ -1,10 +1,25 @@
-import { BrowserRouter } from 'react-router-dom';
+import { useReducer } from 'react';
+import { HashRouter } from 'react-router-dom';
 import { Router } from './components/router';
+import { SettingsContext } from './utils/settings_context';
+
+const settingsReducer = (state, action) => {
+  switch (action.type) {
+    case 'update': {
+      return { ...state, ...action.payload };
+    }
+  }
+  return state;
+};
 
 export const App = () => {
+  const [settings, dispatch] = useReducer(settingsReducer, window.SETTINGS);
+
   return (
-    <BrowserRouter>
-      <Router />
-    </BrowserRouter>
+    <SettingsContext.Provider value={[settings, dispatch]}>
+      <HashRouter>
+        <Router />
+      </HashRouter>
+    </SettingsContext.Provider>
   );
 };
-- 
cgit v1.2.3-70-g09d2

