Skip to content

Commit

Permalink
add routing to profile for after successful signup
Browse files Browse the repository at this point in the history
  • Loading branch information
donsqlin committed Sep 17, 2024
1 parent a96fa5d commit e123724
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions web/src/app/components/AuthForms/SignupForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { NavLink } from 'react-router-dom';
import { Role } from '../../type/role';
import {toast} from "react-toastify";
import {createFSAEUserDto, register_alumni, register_member, register_sponsor} from "@/api/register";
import { useNavigate } from 'react-router-dom';

interface Field {
label: string;
Expand Down Expand Up @@ -108,6 +109,7 @@ const FormComponent: React.FC<FormComponentProps> = ({ fields, onSubmit }) => (
);

const SignupForm = ({ role }: { role: Role }) => {
const navigate = useNavigate();
const handleSubmit = (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
const formData = new FormData(event.target as HTMLFormElement);
Expand Down Expand Up @@ -135,6 +137,7 @@ const SignupForm = ({ role }: { role: Role }) => {
} else {
toast.error('Registering Unknown Role');
}
navigate('/profile', { replace: true });
};

return (
Expand Down

0 comments on commit e123724

Please sign in to comment.