Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Issueing a POST and receiving no id back

$
0
0

@nacho wrote:

I'm implementing an app that uses our own API. In this API, authentication is based on a POST query to a certain URL with basic authentication that returns a couple of tokens that will be later used to "sign" all the requests.

I don't seem to be able to map this request to any model because ember keeps on complaining for the lack of id in the ember model and in the response from the server.

I've tried workarounding this at many stages so that I can benefit of having this as a service and inject the tokens in all the other adapters but I haven't been successful "yet".

So far I tried:

  • Writing a serializer and use the normalizeCreateRecordResponse to add a fake id.

  • Use normalize to normalize the response.

  • Writing a createRecord hook in the adapter and use the super function to issue the query and return a JSON with a fake id.

I'm using a RESTAdapter and a JSONSerializer but so far nothing really worked as I expected and I just collected a set of failed assertions and exceptions on the promises.

Which would be the right approach to handle this efficiently?.

Thank you very much for your help. I can supply more information if needed and I'm really questioning using ember-data due to it being very strict on the API format.

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles