Skip to content

Commit

Permalink
#11 Add currentUser r contexts in App.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraBergstrom committed Jun 21, 2023
1 parent b1a29b6 commit 0e67628
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
import styles from './App.module.css'
import NavBar from './components/NavBar';
import Container from 'react-bootstrap/Container';
import { Route, Switch } from 'react-router-dom';
import './api/axiosDefaults'
import SignUpForm from './pages/auth/SignUpForm';
import LoginForm from './pages/auth/LoginForm'
import styles from "./App.module.css";
import NavBar from "./components/NavBar";
import Container from "react-bootstrap/Container";
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 axios from "axios";

export const CurrentUserContext = createContext();
export const SetCurrentUserContext = createContext();

function App() {
const [currentUser, setCurrentUser] = useState(null);

const handleMount = async () => {
try {
const { data } = await axios.get("dj-rest-auth/user/");
} catch (err) {
console.log(err);
}
};

return (
<div className={styles.App}>
<NavBar />
Expand All @@ -23,4 +37,4 @@ function App() {
);
}

export default App;
export default App;

0 comments on commit 0e67628

Please sign in to comment.