viezel / napp.alloy.adapter.restapi

RestAPI Sync Adapter for Titanium Alloy Framework
197 stars 102 forks source link

Send request method while calling fetch #74

Closed HazemKhaled closed 8 years ago

HazemKhaled commented 9 years ago

Some time i need to fetch POST data, and i don't have access to update the service

exports.definition = {
  config: {
    adapter: {
      type: "restapi",
      collection_name: "user",
      idAttribute: "id"
    },
    URL: 'http://domain.com/api/user',
    debug: 1
  },
  extendModel: function(Model) {
    _.extend(Model.prototype, {
      login: function(params, e) {
        this.fetch({
          url: Model.config.URL + "/login",
          requestMethod: "POST",
          data: params,
          success: e.success,
          error: e.error
        });
      }
    });

    return Model;
  }
};
viezel commented 8 years ago

Looks fine. can you please bump the version and add the change to the changelog in readme?

HazemKhaled commented 8 years ago

Done, check it now

viezel commented 8 years ago

sweet