dimanche 5 février 2017

What is the proper way to make a data process request with Ember data?

I am making a flash card app and the business logic is implemented in the backend.

The previous version I use jquery to fetch data and make request between server and client (see below),

getNextCard() {
    const {URL, headers} = this._getParams('/next_card');

    return Ember.$.ajax(URL, {
        method: "GET",
        headers
    });
},

submitAnswer(card) {
    const {URL, headers} = this._getParams('/process_card');

    return Ember.$.ajax(URL, {
        method: "POST",
        headers,
        data: card
    });
},

I have changed to Ember data in the the current version; however, I am so confusied and do not know what is the proper way to make this kind of request with Ember data.

Should I continue using Ember.$.ajax to make data process request (like code above) and using Ember data solely for data/model CRUD prupose?




Aucun commentaire:

Enregistrer un commentaire