victor-am / rails-ranger

🤠 An opinionated AJAX client for Ruby on Rails APIs
https://victor-am.github.io/rails-ranger/
MIT License
32 stars 5 forks source link

this.client is undefined in readme example #39

Closed ryanmk54 closed 4 years ago

ryanmk54 commented 4 years ago

I am trying to copy the example in the readme, with the following code, but I get the error: this.client is undefined. If I change this.client to client it works fine.

import RailsRanger from 'rails-ranger';
const client = new RailsRanger;
export default {
  client,

  orders: {
    update(params) {
      return this.client.update('orders', params) // <-- error on this line
        .then(response => response.data)
    } 
  }
};
victor-am commented 4 years ago

Hi @ryanmk54 , thanks for pointing it out! It should be fixed on b0e1c02616275cb3e8541bf69e22c8c221b06c05 😄