diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Content/Content.tsx | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/components/Content/Content.tsx b/src/components/Content/Content.tsx index 1341e4f..3d747b2 100644 --- a/src/components/Content/Content.tsx +++ b/src/components/Content/Content.tsx | |||
| @@ -1,17 +1,15 @@ | |||
| 1 | import * as React from "react"; | 1 | import * as React from "react"; |
| 2 | import {Dispatch, SetStateAction, useContext, useMemo} from "react"; | 2 | import {Dispatch, SetStateAction, useContext, useMemo} from "react"; |
| 3 | import {RequestPayload, ResponsePayload} from "~hooks/useRequests"; | 3 | import {RequestPayload, ResponsePayload, Headers} from "~hooks/useRequests"; |
| 4 | import ReactJson from 'react-json-view'; | 4 | import ReactJson from 'react-json-view'; |
| 5 | import styles from './Content.module.scss'; | 5 | import styles from './Content.module.scss'; |
| 6 | import {Button, Col, Container, Row} from "react-bootstrap"; | 6 | import {Button, Col, Container, Row} from "react-bootstrap"; |
| 7 | import {DarkModeContext} from "../../contexts/DarkMode"; | 7 | import {DarkModeContext} from "../../contexts/DarkMode"; |
| 8 | 8 | ||
| 9 | function getHeader(headers: { [key: string]: string }, key: string, unit?: string): string | null { | 9 | function getHeader(headers: Headers, key: string, unit?: string): string | null { |
| 10 | console.log(headers, key) | 10 | console.log(headers, key) |
| 11 | try { | 11 | try { |
| 12 | const [_, value] = Object | 12 | const [_, value] = headers.find(([headerKey]) => headerKey.toLowerCase() === key.toLowerCase()) |
| 13 | .entries(headers) | ||
| 14 | .find(([headerKey]) => headerKey.toLowerCase() === key.toLowerCase()) | ||
| 15 | return unit !== undefined | 13 | return unit !== undefined |
| 16 | ? `${value}${unit}` | 14 | ? `${value}${unit}` |
| 17 | : value | 15 | : value |
