j-frost / billomat-ts

Billomat API implementation in TypeScript for use in Node.js
MIT License
6 stars 5 forks source link

HTTP requests don't seem to work #3

Closed andrenarchy closed 3 years ago

andrenarchy commented 3 years ago

First of all thank you for the library!

In my application (nodejs 13) the GET requests (e.g., clients.list(...)) seem to work fine but when I run clients.create(...) it just returns undefined without creating the client in Billomat. After debugging a little it seems like it's sending a GET request in the end instead of POST.

Also, the following code in create(...) and edit(...) seems wrong:

 const payload: any = {};
 Object.defineProperty(payload, singular, resource);

Shouldn't this be

const payload = { [singular]: resource }

?

j-frost commented 3 years ago

Thanks for using it and contributing!

I have no idea what happened to that typing. Should always have been {} at the very least. I pushed some eslint and prettier confs into master just now and also remerged master into #4.

I'd like to add tests to the newly added resource if at all possible before merging. Won't have the time to do that until the new year, so if you want either of you @andrenarchy @fxmanu can do that, otherwise I'll add it when I get to it.