diff --git a/frontend/src/App.js b/frontend/src/App.js
index 032c7b3..396a789 100644
--- a/frontend/src/App.js
+++ b/frontend/src/App.js
@@ -1,6 +1,6 @@
import React from "react";
import Routes from "./routes";
-import "dotenv/config";
+import "react-toastify/dist/ReactToastify.css";
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";
import { ptBR } from "@material-ui/core/locale";
diff --git a/frontend/src/components/TicketsList/index.js b/frontend/src/components/TicketsList/index.js
index 32a52aa..888d1d6 100644
--- a/frontend/src/components/TicketsList/index.js
+++ b/frontend/src/components/TicketsList/index.js
@@ -339,8 +339,6 @@ const TicketsList = () => {
document.getElementById("sound").play();
};
- console.log(process.env.NODE_ENV);
-
const resetUnreadMessages = ticketId => {
setTickets(prevState => {
const ticketIndex = prevState.findIndex(
diff --git a/frontend/src/context/Auth/useAuth.js b/frontend/src/context/Auth/useAuth.js
index c33e1ec..3cd88da 100644
--- a/frontend/src/context/Auth/useAuth.js
+++ b/frontend/src/context/Auth/useAuth.js
@@ -1,6 +1,8 @@
import { useState, useEffect } from "react";
import { useHistory } from "react-router-dom";
+import { toast } from "react-toastify";
+
import api from "../../services/api";
const useAuth = () => {
@@ -33,7 +35,7 @@ const useAuth = () => {
} catch (err) {
setLoading(false);
setIsAuth(false);
- alert("Erro de autenticação. Por favor, faça login novamente");
+ toast.error("Erro de autenticação. Por favor, faça login novamente");
}
};
checkAuth();
@@ -50,7 +52,7 @@ const useAuth = () => {
setIsAuth(true);
history.push("/chat");
} catch (err) {
- alert(err);
+ toast.error("Erro de autenticação. Verifique os dados de login");
}
};
diff --git a/frontend/src/routes/Route.js b/frontend/src/routes/Route.js
index ff199e3..abaa42f 100644
--- a/frontend/src/routes/Route.js
+++ b/frontend/src/routes/Route.js
@@ -1,11 +1,11 @@
-import React from "react";
-import { BrowserRouter, Route, Switch, Redirect } from "react-router-dom";
+import React, { useContext } from "react";
+import { Route, Redirect } from "react-router-dom";
import Backdrop from "@material-ui/core/Backdrop";
import CircularProgress from "@material-ui/core/CircularProgress";
import { makeStyles } from "@material-ui/core/styles";
-import { AuthContext, AuthProvider } from "../context/Auth/AuthContext";
+import { AuthContext } from "../context/Auth/AuthContext";
const useStyles = makeStyles(theme => ({
backdrop: {
diff --git a/frontend/src/routes/index.js b/frontend/src/routes/index.js
index eae8708..e4e00cd 100644
--- a/frontend/src/routes/index.js
+++ b/frontend/src/routes/index.js
@@ -1,9 +1,6 @@
-import React, { useContext } from "react";
-import { BrowserRouter, Route, Switch, Redirect } from "react-router-dom";
-
-import Backdrop from "@material-ui/core/Backdrop";
-import CircularProgress from "@material-ui/core/CircularProgress";
-import { makeStyles } from "@material-ui/core/styles";
+import React from "react";
+import { BrowserRouter, Switch } from "react-router-dom";
+import { ToastContainer } from "react-toastify";
import MainDrawer from "../components/MainDrawer";
import Dashboard from "../pages/Dashboard/";
@@ -12,81 +9,24 @@ import Signup from "../pages/Signup/";
import Login from "../pages/Login/";
import WhatsAuth from "../pages/WhatsAuth/WhatsAuth";
import Contacts from "../pages/Contacts/";
-import { AuthContext, AuthProvider } from "../context/Auth/AuthContext";
-
-const useStyles = makeStyles(theme => ({
- backdrop: {
- zIndex: theme.zIndex.drawer + 1,
- color: "#fff",
- },
-}));
-
-const PrivateRoute = ({ component: Component, ...rest }) => {
- const classes = useStyles();
- const { isAuth, loading } = useContext(AuthContext);
-
- if (loading)
- return (
-
-
-
- );
-
- return (
-
- isAuth ? (
-
- ) : (
-
- )
- }
- />
- );
-};
-
-const PublicRoute = ({ component: Component, ...rest }) => {
- const classes = useStyles();
- const { isAuth, loading } = useContext(AuthContext);
-
- if (loading)
- return (
-
-
-
- );
-
- return (
-
- !isAuth ? (
-
- ) : (
-
- )
- }
- />
- );
-};
+import { AuthProvider } from "../context/Auth/AuthContext";
+import Route from "./Route";
const Routes = () => {
return (
-
-
+
+
-
-
-
-
+
+
+
+
+
);