Skip to content

Commit

Permalink
feat
Browse files Browse the repository at this point in the history
  • Loading branch information
NishantGupt786 committed Mar 18, 2024
1 parent f1c88ab commit f528457
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import toast from "react-hot-toast";
import axios, { AxiosError } from "axios";
import ToastContainer from "@/components/ToastContainer";
import { useRouter } from "next/navigation";
import { IdeaStore } from "@/store/store";
interface FormValues {
name: string;
track: string;
Expand All @@ -44,6 +45,7 @@ const tracks = [
];

export default function SubmitProjectForm() {
const { getIdea, SetIdea } = IdeaStore();
const router = useRouter();
const form = useForm<FormValues>({
resolver: zodResolver(ideaSchema),
Expand Down Expand Up @@ -71,6 +73,8 @@ export default function SubmitProjectForm() {
void toast.promise(handleSubmit(), {
loading: "Cooking...",
success: () => {
SetIdea("idea found");
void router.push("/home");
return `Project submitted successfully!`;
},
error: (err: AxiosError) => {
Expand Down

0 comments on commit f528457

Please sign in to comment.