Skip to content

Commit

Permalink
add routing to homepage after successful signup
Browse files Browse the repository at this point in the history
  • Loading branch information
donsqlin committed Sep 17, 2024
1 parent 8c460a2 commit a96fa5d
Show file tree
Hide file tree
Showing 3 changed files with 11,735 additions and 7,834 deletions.
9 changes: 5 additions & 4 deletions web/src/app/components/AuthForms/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { NavLink } from 'react-router-dom';
import { useNavigate } from 'react-router-dom';
import { useDispatch } from 'react-redux';
import { toast } from 'react-toastify';
import {login} from "@/api/login";
import {useState} from "react";
import { login } from "@/api/login";
import { useState } from "react";

export function LoginForm() {
const dispatch = useDispatch();
Expand All @@ -31,6 +31,7 @@ export function LoginForm() {
await login(email, password)
.then((response) => {
toast.success('Login Successful');
navigate('/', { replace: true });
// Todo: Do something afterwards.
// handleLoginAs(response.data.userType);
}).catch((error) => {
Expand All @@ -52,8 +53,8 @@ export function LoginForm() {
Login
</Title>

<TextInput placeholder="Enter email" size="lg" mb="lg" value={email} onChange={(event) => setEmail(event.target.value)}/>
<PasswordInput placeholder="Enter password" mt="xl" size="lg" value={password} onChange={(event) => setPassword(event.target.value)}/>
<TextInput placeholder="Enter email" size="lg" mb="lg" value={email} onChange={(event) => setEmail(event.target.value)} />
<PasswordInput placeholder="Enter password" mt="xl" size="lg" value={password} onChange={(event) => setPassword(event.target.value)} />
<Checkbox label="Remember Me" mt="xl" size="md" />
<Button fullWidth mt="xl" mb="md" size="lg" onClick={onLogin}>
Login
Expand Down
Loading

0 comments on commit a96fa5d

Please sign in to comment.