Newer
Older
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React from 'react'
import gql from 'graphql-tag'
import { Query } from '@apollo/react-components'
import User from './User'
const GET_USERS = gql`
{
users {
id
username
teams {
id
role
name
object {
objectId
}
members {
user {
id
username
}
}
}
}
}
`
const UsersManager = () => (
<Query query={GET_USERS}>
{({ loading, error, data }) => {
if (loading) return 'Loading...'
if (error) return `Error! ${error.message}`
return (
<div>
<table>
<thead>
<tr>
<th>id</th>
<th>Username</th>
<th>Email</th>
<th>Admin</th>
<th>Teams</th>
</tr>
</thead>
<tbody>
{data.users.map((user, key) => (
<User key={user.id} number={key + 1} user={user} />
))}
</tbody>
</table>
</div>
)
}}
</Query>
)
export default UsersManager