Skip to content

Bugfix/undefined returned by some api methods - #1

Open
GearoidSugrue wants to merge 2 commits into
MichielMag:masterfrom
GearoidSugrue:bugfix/undefined-returned-by-some-api-methods
Open

Bugfix/undefined returned by some api methods#1
GearoidSugrue wants to merge 2 commits into
MichielMag:masterfrom
GearoidSugrue:bugfix/undefined-returned-by-some-api-methods

Conversation

@GearoidSugrue

Copy link
Copy Markdown

Hello! Firstly thanks for this node module, its great! Especially all the Types and Interfaces, it saved me a lot of time :)
I've found a few small issues and would like to help fix.

The first one is that NS v3 responses are different from the v2 ones. They don't follow the same response pattern of:

{	
   links: ...
   meta: ...
   payload: ...
   etc...
}

Instead, they just return the data. For example, GET /trips response is:

{
  "trips": [
      ....
   ]
}

image

It's an simple fix. Just resolve(message) instead of resolve(message.payload) in getTrip and getTrips in api.ts.

Most of the other changes were to fix the Typescript errors it caused. I hope my solution is ok? Feel free to make recommendations!
Also, I had to upgrade typescript. It was failing to build because of the comments in the tsconfig.json file.

As I mentioned, there are a few other minor issues. I'll create separate issues for them.

@MichielMag

Copy link
Copy Markdown
Owner

Thanks for the PR! I'll check it and functionally test it soon.

@GearoidSugrue

Copy link
Copy Markdown
Author

Hey, have you had a chance to look at this? 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants