Finished AuthContext

This commit is contained in:
Cassio Santos
2020-06-15 10:25:52 -03:00
parent 0b75b4aa52
commit eaea17fb66
20 changed files with 375 additions and 1149 deletions

View File

@@ -1,60 +1,10 @@
import React from "react";
import { BrowserRouter, Route, Switch } from "react-router-dom";
import { toast, ToastContainer } from "react-toastify";
import Routes from "./routes";
import Dashboard from "./pages/Home/Dashboard";
import Chat from "./pages/Chat/Chat";
import Profile from "./pages/Profile/Profile";
import Signup from "./pages/Signup/Signup";
import Login from "./pages/Login/Login";
import "./App.css";
const App = () => {
const showToast = (type, message) => {
switch (type) {
case 0:
toast.warning(message);
break;
case 1:
toast.success(message);
break;
default:
break;
}
};
return (
<BrowserRouter>
<ToastContainer
autoClose={2000}
hideProgressBar={true}
position={toast.POSITION.TOP_CENTER}
/>
<Switch>
<Route exact path="/" render={props => <Dashboard />} />
<Route
exact
path="/login"
render={props => <Login showToast={showToast} />}
/>
<Route
exact
path="/profile"
render={props => <Profile showToast={showToast} />}
/>
<Route
exact
path="/signup"
render={props => <Signup showToast={showToast} />}
/>
<Route
exact
path="/chat"
render={props => <Chat showToast={showToast} />}
/>
</Switch>
</BrowserRouter>
);
return <Routes />;
};
export default App;