Skip to content

Commit

Permalink
Merge pull request #38 from NishantGupt786/master
Browse files Browse the repository at this point in the history
pr
  • Loading branch information
NishantGupt786 authored Mar 14, 2024
2 parents 2defa96 + f7963cf commit b7945e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 5 additions & 7 deletions devsoc24-portal-fe/src/app/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import Sponsors from "@/components/sponsors";

interface ideaProps {
message: string;
status: boolean;
status: string;
data?: {
title: string;
description: string;
Expand Down Expand Up @@ -134,8 +134,9 @@ export default function HomePage() {
withCredentials: true,
},
);
SetIdea("idea found");
// console.log("FETCH IDEA: ", response);
if (response.data.status === "success") {
SetIdea("idea found");
}
} catch (e) {
if (axios.isAxiosError(e)) {
const axiosError = e as AxiosError<APIResponse>;
Expand All @@ -144,10 +145,7 @@ export default function HomePage() {
router.push("/");
break;
case 404:
if (axiosError.response?.data.message === "user does not exist") {
router.push("/");
}
// console.log("no team");
SetIdea("");
break;
case 417:
// console.log("team no idea");
Expand Down
4 changes: 3 additions & 1 deletion devsoc24-portal-fe/src/app/submit-idea/submit-idea-form.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm, Controller } from "react-hook-form";

import {IdeaStore} from "@/store/store";
import {
Form,
FormControl,
Expand Down Expand Up @@ -38,6 +38,7 @@ import ToastContainer from "@/components/ToastContainer";
const tracks = ["Track 1", "Track 2", "Track 3"];

export default function SubmitIdeaForm() {
const { getIdea, SetIdea } = IdeaStore();
const router = useRouter();
const form = useForm<FormValues>({
resolver: zodResolver(ideaSchema),
Expand Down Expand Up @@ -65,6 +66,7 @@ export default function SubmitIdeaForm() {
void toast.promise(handleSubmit(), {
loading: "Cooking...",
success: () => {
SetIdea("idea found");
void router.push("/home");
return `Idea submitted successfully!`;
},
Expand Down

0 comments on commit b7945e4

Please sign in to comment.