add mutate to signup

This commit is contained in:
Tommi S
2023-12-15 21:22:35 +02:00
parent d5f6cb359f
commit 10ff54f6b0
+2 -1
View File
@@ -5,7 +5,7 @@ import { useRouter } from "next/router";
import { ISubmitEvent } from "@rjsf/core";
import { toast } from "react-toastify";
import axios from "axios";
import useSWR from "swr";
import useSWR, { mutate } from "swr";
import { Signup, SignupForm } from "@models/Signup";
import SignupApi from "@api/signupApi";
import SignUpPageView from "@views/SignUpPage/SignUpPageView";
@@ -50,6 +50,7 @@ const SignUpPage: NextPage<InitialProps> = ({ initialForm }) => {
try {
await SignupApi.createSignup(payload);
toast.success("Sign-up submitted successfully 😎");
mutate(URL);
} catch (err) {
console.error(err);
toast.error("Uh oh! Sign-up failed! 😟");