You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Backend: Rails + JSONAPI::Resources
Frontend: Ember
Had trouble getting ember-orbit to store to localstorage using LocalStorageSource. Seems to only live in memory
Trying to work directly with orbit now. Just playing around within an initializer doing the following:
importEmberfrom'ember';importOrbitfrom'orbit';importLocalStorageSourcefrom'orbit-common/local-storage-source';importMemorySourcefrom'orbit-common/memory-source';importJSONAPISourcefrom'orbit-common/jsonapi-source';importOCfrom'orbit-common'importconfigfrom'../config/environment';exportvarinitialize=function(container,application){Orbit.Promise=Ember.RSVP.Promise;Orbit.ajax=Ember.$.ajax;// Create data sources with a common schemavarschema=newOC.Schema({keys: {__id: {primaryKey: true,defaultValue: Orbit.uuid}},models: {contact: {attributes: {firstName: {type: 'string'},lastName: {type: 'string'}}}}});varmemorySource=newMemorySource(schema);varrestSource=newJSONAPISource(schema);varlocalSource=newLocalStorageSource(schema);varmemToLocalConnector=newOrbit.TransformConnector(memorySource,localSource);varmemToRestConnector=newOrbit.TransformConnector(memorySource,restSource);varrestToMemConnector=newOrbit.TransformConnector(restSource,memorySource);// Add a record to the memory sourcememorySource.add('contact',{firstName: 'Tom',lastName: 'Jones'}).then(function(contact){console.log('Contact added - ',contact.firtName,'(id:',contact.id,')');});};exportdefault{name: 'inject-store',initialize: initialize};
So the localStorage works now, I see the data getting stored, but when it tries to sync to the jsonapi source, it tries to post the following json:
On a side note, it would be super helpful I think to list the version of json-api spec that the clients conform to. Both Orbit and JR. I see JR has a note stating "implements latest json-api" in one of the commit notes, but it would be great to have it in the readme with the version number.
Thanks to all of you for the amazing work. It's such an exciting project!
The text was updated successfully, but these errors were encountered:
I'm working on bringing the JSONAPISource up to date with the spec this week, and will be tracking progress via #113. My goal is complete compliance by the JSON API 1.0 release date - May 21.
Hi,
Backend:
Rails + JSONAPI::Resources
Frontend:
Ember
Had trouble getting
ember-orbit
to store to localstorage usingLocalStorageSource
. Seems to only live in memoryTrying to work directly with
orbit
now. Just playing around within an initializer doing the following:So the localStorage works now, I see the data getting stored, but when it tries to sync to the jsonapi source, it tries to post the following json:
using the modelType as key instead of what jsonapi resource has listed in the docs:
On a side note, it would be super helpful I think to list the version of
json-api
spec that the clients conform to. BothOrbit
andJR
. I seeJR
has a note stating "implements latest json-api" in one of the commit notes, but it would be great to have it in the readme with the version number.Thanks to all of you for the amazing work. It's such an exciting project!
The text was updated successfully, but these errors were encountered: