Use instance on fetchWithInstance instead of this.axios and remove method from FortniteAPIError#44
Conversation
ThisNils
left a comment
There was a problem hiding this comment.
Hey, good catch on the instance thing, no idea how I missed that.
Let's keep the method attribute and change how the error is being thrown so it's not undefined:
- throw new FortniteAPIError(e.response.data, config, e.response.status);
+ throw new FortniteAPIError(e.response.data, e.config ?? config, e.response.status);|
Sorry for the late reply btw. I didn't get any notifications since I don't technically own this repo. You can join the fortnite-api Discord server and ping me there next time. |
I'm so sorry man. I totally forgot about this. I made the changes you suggested, is that good enough? |
|
No worries. The changes look good, just one thing: could you also readd the following part of the FortniteAPIError: /**
* The HTTP method
*/
public method: string;Thanks for your contribution! |
There it is. Thank you u u |
The reason for removing method property from FortniteAPIError is that it's never present, and the method is actually static so no point on specifying it on an error. Also, when using CommonJS and requesting a non-existent user's brStats, it will fail but because the ! is not present on the transpiled version of FortniteAPIError, giving an error when using toUpperCase():
And i noticed the rate-limited axios instance was never used in fetchWithInstance, so i changed that too.
If there's anything wrong tell me.