diff options
Diffstat (limited to 'client/src/components/Admin.tsx')
-rw-r--r-- | client/src/components/Admin.tsx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/client/src/components/Admin.tsx b/client/src/components/Admin.tsx new file mode 100644 index 0000000..1c941a5 --- /dev/null +++ b/client/src/components/Admin.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import { useGetGuestsQuery } from '../apiSlice'; + +function Admin() { + const { + data: guests, + isLoading, + isSuccess, + isError, + error, + } = useGetGuestsQuery(); + + let content; + + if (isLoading) { + content = <p>Loading...</p>; + } else if (isSuccess) { + content = JSON.stringify(guests); + } else if (isError) { + content = <>{error.toString()}</>; + } + + return ( + <> + <p>Admin</p> + {content} + </> + ); +} + +export default Admin; |