diff options
author | HombreLaser <sebastian-440@live.com> | 2023-05-06 00:44:46 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-05-06 00:44:46 -0600 |
commit | f4ea6fb6c577d41f72cc33283e42492e03833f00 (patch) | |
tree | 643d15132c6fd76adc268153390960adf0a228dd /src/clients/api_client.ts | |
parent | 8040a87759746c81694d2cbd1fb82039eb0e68f0 (diff) |
Añade ruta account
Diffstat (limited to 'src/clients/api_client.ts')
-rw-r--r-- | src/clients/api_client.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/clients/api_client.ts b/src/clients/api_client.ts index c55a365..7d2cf34 100644 --- a/src/clients/api_client.ts +++ b/src/clients/api_client.ts @@ -3,16 +3,16 @@ import axios from "axios"; export class ApiClient { readonly url = "http://localhost:3000/api"; - async get(path: string, params?: URLSearchParams) { + async get(path: string, params?: URLSearchParams, headers?: object) { const request_url = `${ this.url }${ path }`; - const response = await this.makeGetRequest(request_url); + const response = await this.makeGetRequest(request_url, headers); return response; } - async post(path: string, data: FormData) { + async post(path: string, data: FormData, headers?: object) { const request_url = `${ this.url }${ path }`; - const response = await axios.post(request_url, data, { headers: { "Content-Type": "multipart/form-data"} }); + const response = await axios.post(request_url, data, headers); return response; } @@ -27,9 +27,9 @@ export class ApiClient { return [product_response, product_reviews]; } - private async makeGetRequest(request_url: string) { + private async makeGetRequest(request_url: string, headers?: object) { try { - const response = await axios.get(request_url); + const response = await axios.get(request_url, headers); return response } catch(error) { |