added login feedback snackbar
This commit is contained in:
@@ -10,6 +10,7 @@ import Logo from "../../img/logo.png";
|
||||
import TextField from '@material-ui/core/TextField';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import { Redirect } from "react-router-dom";
|
||||
import LoginFeedback from './loginfeedback';
|
||||
|
||||
const url = "/simcompanies/API/user/create"
|
||||
|
||||
@@ -59,14 +60,12 @@ const CssTextField = withStyles({
|
||||
},
|
||||
})(TextField);
|
||||
|
||||
|
||||
|
||||
export default function CreateAccount() {
|
||||
const classes = useStyles();
|
||||
const [username, setUsername] = React.useState("");
|
||||
const [password, setPassword] = React.useState("");
|
||||
const [login, setLogin] = React.useState(true);
|
||||
|
||||
const [status, setStatus] = React.useState(null);
|
||||
|
||||
const putCreateAccount = async (url, data) => {
|
||||
const response = await fetch(url, {
|
||||
@@ -80,7 +79,7 @@ export default function CreateAccount() {
|
||||
referrerPolicy: 'no-referrer',
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
|
||||
setStatus(response.status)
|
||||
if (response.status == "200") {
|
||||
setLogin(false)
|
||||
}
|
||||
@@ -157,6 +156,7 @@ export default function CreateAccount() {
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<LoginFeedback login={status} successText="Account created successfully" errorText="Oops something went wrong"></LoginFeedback>
|
||||
</Box > : <Redirect to={"/login"} />
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user