Closed sakozz closed 5 years ago
No, you are right. It is not a bug, rather a missing feature. But I experimented with this today. Have a look at the pushPayload method inside the rest adapter. Copy it to your serializer in app/serializers/application.js, you will probably receive an error from modelNameFromPayloadKey because that method does not (yet) exists in the localforage adapter. Replace it, and then you should be fine. If you succeed, you could create a PR so we all can use it. I also might invest some time in the issue.
@sunil-shrestha Forgot to mention an important detail. I believe that pushPayload does not store data in the adapter. It only pushes records in the store. Please check for yourself to be sure.
In order to push data into localforage, you can call adapterFor('user') on the store and then with the adapter call the persistData method in the localforage adapter
Thanks, i guess, i am looking for something like persistData method. I will try this and let you know.
Hi guys, I come to a case where i need to fetch data in online-mode, store on device and then use in offline-mode. I used normal ajax call, received JSON data and tried to push to store as follows.
This ends up with error message "Uncaught TypeError: serializer.pushPayload is not a function" . Am i missing something or anyway i can use this ad-on for this case? Thanks for Help in advance.