Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const [isLoading, setLoading] = useState(false);
- const [error, setError] = useState("");
- const [isLoggedIn, setLoggedIn] = useState(false);
- const onSubmit = async e => {
- e.preventDefault();
- setLoading(true);
- try {
- await login({ name, password });
- setLoading(false);
- setName("");
- setPassword("");
- setLoggedIn(true);
- } catch (error) {
- setLoading(false);
- setError("Invalid Username Password Combination");
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement