Skip to content

Commit

Permalink
[#46] - Fix type problem PokemonApi
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanson25 committed Oct 10, 2024
1 parent 0af59db commit 39fa2e9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/apis/PokemonApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,25 @@ class PokemonApiClass {
},
);
}
makeRequest(request: request) {
makeRequest(request: request): Promise<AxiosResponse> {
const { method, url, axiosRequest = {} } = request;
const R = { url: `${method}:${url}`, axiosRequest: {}, method: method };

const axiosRequestPromise = this._axios[method](`${url}`, axiosRequest);

const R = {
url: `${method}:${url}`,
axiosRequest: axiosRequestPromise,
method: method,
};

R.axiosRequest = this._axios[method](`${url}`, axiosRequest);
this.requests.push(R);
return R.axiosRequest;
}
get(url: string, axiosRequest: AxiosResponse | {} = {}) {
get(
url: string,
axiosRequest: AxiosResponse | {} = {},
): Promise<AxiosResponse> {
return this.makeRequest({ method: 'get', url, axiosRequest });
}
}
Expand Down

0 comments on commit 39fa2e9

Please sign in to comment.