Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. const [isLoading, setLoading] = useState(false);
  2. const [error, setError] = useState("");
  3. const [isLoggedIn, setLoggedIn] = useState(false);
  4.  
  5. const onSubmit = async e => {
  6. e.preventDefault();
  7. setLoading(true);
  8. try {
  9. await login({ name, password });
  10. setLoading(false);
  11. setName("");
  12. setPassword("");
  13. setLoggedIn(true);
  14. } catch (error) {
  15. setLoading(false);
  16. setError("Invalid Username Password Combination");
  17. }
  18. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement