Skip to content

Commit

Permalink
Merge pull request #69 from NishantGupt786/master
Browse files Browse the repository at this point in the history
feat
  • Loading branch information
NishantGupt786 authored Mar 18, 2024
2 parents f1c88ab + f528457 commit 7f3b56e
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 7f3b56e

Please sign in to comment.