Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,24 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
<% } -%>
parseResponse: (params, response) => {
<% if (includeComments) { -%>
// In case error was received, it's a good practice to return meaningful information to user
// For each 'param' a new response object is created and returned as an array
<% } -%>
if (!response.data) {
return params.map((param) => {
return params.map((param) => {
<% if (includeComments) { -%>
// In case error was received, it's a good practice to return meaningful information to user
<% } -%>
const baseSymbol = param.base.toUpperCase()
if (!response.data || !response.data[baseSymbol]) {
return {
params: param,
response: {
errorMessage: `The data provider didn't return any value for ${param.base}/${param.quote}`,
statusCode: 502,
},
}
})
}
}

<% if (includeComments) { -%>
// For successful responses for each 'param' a new response object is created and returned as an array
<% } -%>
return params.map((param) => {
const result = response.data[param.base.toUpperCase()].price
const result = response.data[baseSymbol].price
<% if (includeComments) { -%>
// Response objects, whether successful or errors, contain two properties, 'params' and 'response'. 'response' is what will be
// stored in the cache and returned as adapter response and 'params' determines the identifier so that the next request with same 'params'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "<%- standalone ? "./tsconfig.base.json" : "../../tsconfig.base.json" %>",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
"rootDir": "src",
"noUncheckedIndexedAccess": true
},
"include": ["src/**/*", "src/**/*.json"],
"exclude": ["dist", "**/*.spec.ts", "**/*.test.ts"]
Expand Down
Loading