Skip to content

Commit 604781f

Browse files
authored
Merge pull request #44 from lotte25/master
Use instance on fetchWithInstance instead of this.axios and remove method from FortniteAPIError
2 parents 19c16f3 + b7b11f0 commit 604781f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/exceptions/FortniteAPIError.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class FortniteAPIError extends Error {
99
* The HTTP method
1010
*/
1111
public method: string;
12-
12+
1313
/**
1414
* The URL of the requested API endpoint
1515
*/
@@ -35,7 +35,7 @@ class FortniteAPIError extends Error {
3535
this.name = 'FortniteAPIError';
3636
this.message = error.error;
3737

38-
this.method = request.method!.toUpperCase();
38+
this.method = request.method?.toUpperCase() ?? 'GET'
3939
this.url = request.url!;
4040
this.httpStatus = status;
4141
this.requestParams = request.params;

src/http/HTTP.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class HTTP {
4343
};
4444

4545
try {
46-
const response = await this.axios(config);
46+
const response = await instance(config);
4747

4848
return response.data;
4949
} catch (e) {
@@ -56,7 +56,7 @@ class HTTP {
5656
}
5757
}
5858

59-
throw new FortniteAPIError(e.response.data, config, e.response.status);
59+
throw new FortniteAPIError(e.response.data, e.config ?? config, e.response.status);
6060
}
6161

6262
throw e;

0 commit comments

Comments
 (0)