mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 20:59:16 +00:00
feat: added signup sucess and error msgs
This commit is contained in:
@@ -1,15 +1,13 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import api from "../../services/api";
|
|
||||||
import { Link as RouterLink } from "react-router-dom";
|
import { Link as RouterLink } from "react-router-dom";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
import Avatar from "@material-ui/core/Avatar";
|
import Avatar from "@material-ui/core/Avatar";
|
||||||
import Button from "@material-ui/core/Button";
|
import Button from "@material-ui/core/Button";
|
||||||
import CssBaseline from "@material-ui/core/CssBaseline";
|
import CssBaseline from "@material-ui/core/CssBaseline";
|
||||||
import TextField from "@material-ui/core/TextField";
|
import TextField from "@material-ui/core/TextField";
|
||||||
// import FormControlLabel from "@material-ui/core/FormControlLabel";
|
|
||||||
// import Checkbox from "@material-ui/core/Checkbox";
|
|
||||||
import Link from "@material-ui/core/Link";
|
import Link from "@material-ui/core/Link";
|
||||||
import Grid from "@material-ui/core/Grid";
|
import Grid from "@material-ui/core/Grid";
|
||||||
import Box from "@material-ui/core/Box";
|
import Box from "@material-ui/core/Box";
|
||||||
@@ -18,18 +16,20 @@ import Typography from "@material-ui/core/Typography";
|
|||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
import Container from "@material-ui/core/Container";
|
import Container from "@material-ui/core/Container";
|
||||||
|
|
||||||
function Copyright() {
|
import api from "../../services/api";
|
||||||
|
|
||||||
|
const Copyright = () => {
|
||||||
return (
|
return (
|
||||||
<Typography variant="body2" color="textSecondary" align="center">
|
<Typography variant="body2" color="textSecondary" align="center">
|
||||||
{"Copyright © "}
|
{"Copyright © "}
|
||||||
<Link color="inherit" href="https://material-ui.com/">
|
<Link color="inherit" href="https://economicros.com.br/">
|
||||||
Canove
|
Canove
|
||||||
</Link>{" "}
|
</Link>{" "}
|
||||||
{new Date().getFullYear()}
|
{new Date().getFullYear()}
|
||||||
{"."}
|
{"."}
|
||||||
</Typography>
|
</Typography>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
const useStyles = makeStyles(theme => ({
|
const useStyles = makeStyles(theme => ({
|
||||||
paper: {
|
paper: {
|
||||||
@@ -65,9 +65,10 @@ const SignUp = () => {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
try {
|
try {
|
||||||
await api.post("/auth/signup", user);
|
await api.post("/auth/signup", user);
|
||||||
|
toast.success("Usuário criado com sucesso! Faça seu login.");
|
||||||
history.push("/login");
|
history.push("/login");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
alert(err);
|
toast.error("Erro ao criar usuário. Verifique os dados informados.");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user