summaryrefslogtreecommitdiff
path: root/src/components/Rsvp.tsx
blob: 858ca71c477b90bbefd010d2c4500df9d0879707 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { useState } from 'react';
import RsvpForm from './RsvpForm';
import GuestLogin from './GuestLogin';
import { useGetGuestsQuery } from '../apiSlice'

function Rsvp() {
  // Enter your name to RSVP; query the database
  const [loggedIn, setLoggedIn] = useState(false);

  const {
    data: guests,
    isLoading,
    isSuccess,
    isError,
    error
  } = useGetGuestsQuery()

  return (
    <>
      {loggedIn ? (
        <RsvpForm />
      ) : (
        <GuestLogin loggedIn={loggedIn} setLoggedIn={setLoggedIn} />
      )}
    </>
  )
}

export default Rsvp;