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

How to serialize all keys of object before send request when using ember-ajax

$
0
0

@Marcelo_Alves wrote:

Hi!

I'm using ember-ajax to send data to endpoint that are not rest, like /users/confirm-email, /users/reset-password, etc, example:

const attributes = changeset.getProperties('company', 'email', 'country', 'firstName', 'lastName', 'password');
this.get('ajax').request('/users', {
  method: 'POST',
  data: {
    data: {
      attributes,
      type: 'users'
    }
  }
}).then(() => {
  this.transitionToRoute('users.confirm-email', {
    queryParams: {
      email: changeset.get('email')
    }
  });
}).catch((response) => {
  this.errorHandler(response);
});

My API was made in Rails, therefore i'm using underscore_case, but in this case i'm sending data with camelCase pattern, and i would like to change it to underscore, something like the serializer that ember-data uses, is it possible? How to do it?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles