Skip to content

Commit

Permalink
code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourav-Tekdi committed Dec 18, 2024
1 parent 74e7406 commit 2f9a39e
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/middleware/gateway.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,17 @@ export class GatewayService {
) {
try {
let response;
if(method == 'POST'){
response = await axios.post(url, formData, {
headers: {
...formData.getHeaders(),
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
});
}
if(method == 'PATCH'){
response = await axios.patch(url, formData, {
headers: {
...formData.getHeaders(),
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
});
}
const headers = {
...formData.getHeaders(),
...(token ? { Authorization: `Bearer ${token}` } : {}),
};
response = await axios({
method: method.toLowerCase(),
url,
data: formData,
headers,
});


res.locals.responseBody = response.data;
res.status(response.status);
Expand Down

0 comments on commit 2f9a39e

Please sign in to comment.