Skip to content

Commit 6c76767

Browse files
committed
allow contractors as object
1 parent 3f9ee35 commit 6c76767

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tutorcruncher-socket",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "TutorCruncher socket",
55
"author": "Samuel Colvin <[email protected]>",
66
"private": false,

public/simple/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
</main>
3333
</body>
3434
<script>
35-
window.socket = socket('9c79f14df986a1ec693c')
35+
var public_key = '9c79f14df986a1ec693c'
36+
var api_root = null // 'https://socket-beta.tutorcruncher.com' 'http://localhost:8000'
37+
window.socket = socket(public_key, {api_root: api_root})
3638
</script>
3739
</html>

src/components/contractors/Contractors.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ class Contractors extends Component {
7676
pagination: this.props.config.pagination,
7777
page: page,
7878
})
79-
const contractors = await this.props.root.requests.get('contractors', args)
79+
const data = await this.props.root.requests.get('contractors', args)
80+
let contractors
81+
if (Array.isArray(data)) {
82+
contractors = data
83+
} else {
84+
contractors = data.results
85+
}
8086
this.props.config.event_callback('updated_contractors', contractors)
8187
this.setState({contractors: []})
8288
setTimeout(() => this.setState({

0 commit comments

Comments
 (0)