Skip to content

Commit

Permalink
feat: upgrade axios
Browse files Browse the repository at this point in the history
  • Loading branch information
osslgtm committed Jun 28, 2024
1 parent cde5359 commit 6fdbca5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
22 changes: 7 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@tradetrust-tt/tradetrust-utils": "^1.13.4",
"@tradetrust-tt/tt-verify": "^8.8.5",
"ajv": "^8.6.0",
"axios": "^0.21.4",
"axios": "^1.7.2",
"babel-jest": "^29.7.0",
"cross-env": "^7.0.3",
"debug": "^4.3.1",
Expand Down
19 changes: 8 additions & 11 deletions src/common/API/storageAPI.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import { utils } from "@tradetrust-tt/tradetrust";
import axios, { AxiosResponse } from "axios";
import axios, { AxiosResponse, AxiosHeaders } from "axios";
import { DocumentStorage, WrappedDocument } from "../../types";
import { decodeQrCode } from "../utils";

interface Headers {
"Content-Type": string;
"x-api-key": string;
}

const getHeaders = (documentStorage: DocumentStorage): Headers => {
const headers = {
const getHeaders = (documentStorage: DocumentStorage): AxiosHeaders => {
const headers = new AxiosHeaders({
"Content-Type": "application/json",
} as Headers;
});

const xApiKey = "x-api-key";

if (documentStorage.apiKey)
headers[xApiKey] = process.env.REACT_APP_API_KEY_DOCUMENT_STORAGE
if (documentStorage.apiKey) {
const apiKey = process.env.REACT_APP_API_KEY_DOCUMENT_STORAGE
? process.env.REACT_APP_API_KEY_DOCUMENT_STORAGE
: documentStorage.apiKey;
headers.set(xApiKey, apiKey);
}

return headers;
};
Expand Down

0 comments on commit 6fdbca5

Please sign in to comment.