summaryrefslogtreecommitdiff
path: root/client/src/components/Admin.tsx
blob: 1c941a52992fa68c5e6036688e1c01a15b334bf5 (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
30
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;