From 94e42f0965d7f544b0ff013af0628686e9bc033c Mon Sep 17 00:00:00 2001 From: SandraBergstrom Date: Wed, 21 Jun 2023 14:11:38 +0000 Subject: [PATCH] #11 Add current user provider --- src/App.js | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/App.js b/src/App.js index 3822221..7bc646d 100644 --- a/src/App.js +++ b/src/App.js @@ -5,7 +5,7 @@ import { Route, Switch } from "react-router-dom"; import "./api/axiosDefaults"; import SignUpForm from "./pages/auth/SignUpForm"; import LoginForm from "./pages/auth/LoginForm"; -import { createContext, useState } from "react"; +import { createContext, useEffect, useState } from "react"; import axios from "axios"; export const CurrentUserContext = createContext(); @@ -22,18 +22,26 @@ function App() { } }; + useEffect(() => { + handleMount(); + }, []); + return ( -
- - - -

Home Page

} /> - } /> - } /> -

Page not found!

} /> -
-
-
+ + +
+ + + +

Home Page

} /> + } /> + } /> +

Page not found!

} /> +
+
+
+
+
); }