beauby / jsonapi-datastore

JavaScript client-side JSON API data handling made easy.
MIT License
195 stars 40 forks source link

TypeError: Cannot read property 'bind' of undefined #25

Closed krainboltgreene closed 7 years ago

krainboltgreene commented 8 years ago
syncRecord = this.syncRecord.bind(this);
beauby commented 8 years ago

Hi @krainboltgreene, could you give a bit more context about when this error happens?

krainboltgreene commented 8 years ago

After looking it appears to happen when I give a full json api payload, where the root keys are data and links. However, when I give it just the data value I receive back an empty array.

beauby commented 8 years ago

Could you provide an example of a failing payload?

krainboltgreene commented 8 years ago

Sure: https://gist.github.com/krainboltgreene/7184be7382e14284797a

beauby commented 8 years ago

Ok so I just tested locally and it worked. Could you confirm this payload is failing on your end and describe your exec environment?

krainboltgreene commented 8 years ago

I can do you one better, here's the repository: https://github.com/lacqueristas/www

Just find a way to respond with that payload when a GET http://localhost:9000/api/v2/activities request comes in.

krainboltgreene commented 8 years ago

In this case replace client/index.js:68 with STORE.sync, and define const STORE = new JsonApiDataStore() somewhere above main.

beauby commented 7 years ago

Closing this as it seemed to be a usage error rather than a bug. Feel free to reopen if needed.