blob: f1845b4888253d33044487a372e095fc607edf58 (
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 '../slices/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;
|