From 03ca04fdb738cc151d775b76e1bc38aec792521a Mon Sep 17 00:00:00 2001
From: Michael Hunteman <michael@huntm.net>
Date: Sun, 7 Jul 2024 11:54:22 -0700
Subject: Redirect to guest login after submitting

---
 client/src/components/RsvpForm.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'client/src/components/RsvpForm.tsx')

diff --git a/client/src/components/RsvpForm.tsx b/client/src/components/RsvpForm.tsx
index 71ae7d0..f20d810 100644
--- a/client/src/components/RsvpForm.tsx
+++ b/client/src/components/RsvpForm.tsx
@@ -1,6 +1,6 @@
 import React from 'react';
 import { useRef } from 'react';
-import { useOutletContext } from 'react-router-dom';
+import { useNavigate, useOutletContext } from 'react-router-dom';
 import {
   Button,
   Container,
@@ -20,6 +20,7 @@ function RsvpForm() {
   const [updateGuest] = useUpdateGuestMutation();
   const guest: Guest = useOutletContext();
   const previousPartySize = useRef(guest?.partySize - 1);
+  const navigate = useNavigate();
 
   const {
     register,
@@ -42,6 +43,7 @@ function RsvpForm() {
 
   const onSubmit = async (data: Guest) => {
     updateGuest({ ...data });
+    navigate('/guest/login');
   };
 
   const { fields, append, remove } = useFieldArray({
-- 
cgit v1.2.3

