mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
Update: add more toast notifications, update position
Also set Account page to use UserContext. Refactored api requests out of components.
This commit is contained in:
@@ -32,15 +32,15 @@ const LoginForm = () => {
|
||||
const { mutate } = useContext(UserContext);
|
||||
|
||||
const onSubmit: SubmitHandler<LoginT> = async (data) => {
|
||||
const id = toast.loading('Logging in.');
|
||||
const loadingToast = toast.loading('Logging in...');
|
||||
try {
|
||||
await sendLoginUserRequest(data);
|
||||
await mutate!();
|
||||
toast.remove(id);
|
||||
toast.remove(loadingToast);
|
||||
toast.success('Logged in!');
|
||||
await router.push(`/user/current`);
|
||||
} catch (error) {
|
||||
toast.remove(id);
|
||||
toast.remove(loadingToast);
|
||||
createErrorToast(error);
|
||||
reset();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user