-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.jsx
More file actions
39 lines (34 loc) · 890 Bytes
/
App.jsx
File metadata and controls
39 lines (34 loc) · 890 Bytes
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
import React from 'react';
import SwillSDK from 'swill-sdk';
import CssBaseline from '@material-ui/core/CssBaseline';
import ResourceList from './ResourceList';
import config from '../config.json';
class App extends React.Component {
constructor() {
super();
this.state = {
loadingSwill: true,
actors: null
};
}
async componentWillMount() {
const setup = {
server: `http://${config.server ? config.server : window.location.hostname}`
};
const sdk = SwillSDK(setup);
this.setState({
actors: await sdk.resources.actors.getActors(),
loadingSwill: false
});
}
render() {
return (
<React.Fragment>
<CssBaseline />
{this.state.loadingSwill ?
<div>Loading...</div> : <ResourceList list={this.state.actors} resource="Actor" />}
</React.Fragment>
);
}
}
export default App;