summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom van der Lee <tom@vanderlee.io>2022-02-07 22:05:04 +0100
committerGravatar Tom van der Lee <tom@vanderlee.io>2022-02-07 22:05:04 +0100
commitefb3fae035c7773a233d2bb3ecc455a956c80eff (patch)
tree3f13a35c721f652ebdf8b8e4d5d7aaabf3a9add9
parent9cc204b0613a677bb3fec0b7bd357eb2968144ae (diff)
downloadclient-1.2.2.tar.gz
client-1.2.2.tar.bz2
client-1.2.2.zip
Updated uiv1.2.2
-rw-r--r--src/components/Details/Details.tsx8
-rw-r--r--src/hooks/useRequests.tsx10
2 files changed, 6 insertions, 12 deletions
diff --git a/src/components/Details/Details.tsx b/src/components/Details/Details.tsx
index d4bb07a..96f0790 100644
--- a/src/components/Details/Details.tsx
+++ b/src/components/Details/Details.tsx
@@ -1,6 +1,6 @@
1import * as React from "react"; 1import * as React from "react";
2import {useCallback, useMemo, useState} from "react"; 2import {useCallback, useMemo, useState} from "react";
3import {RequestResponse} from "~hooks/useRequests"; 3import {RequestResponse, Headers} from "~hooks/useRequests";
4import styles from "./Details.module.scss"; 4import styles from "./Details.module.scss";
5import RequestSummary from "../RequestSummary/RequestSummary"; 5import RequestSummary from "../RequestSummary/RequestSummary";
6import Content from "../Content/Content"; 6import Content from "../Content/Content";
@@ -28,9 +28,7 @@ function Timing({ timing }: TimingProps) {
28 28
29interface HeadersProps { 29interface HeadersProps {
30 title: string 30 title: string
31 headers: { 31 headers: Headers
32 [key: string]: string
33 }
34} 32}
35 33
36function Headers({ title, headers }: HeadersProps) { 34function Headers({ title, headers }: HeadersProps) {
@@ -50,7 +48,7 @@ function Headers({ title, headers }: HeadersProps) {
50 </thead> 48 </thead>
51 <tbody> 49 <tbody>
52 { 50 {
53 Object.entries(headers).map(([key, value]) => ( 51 headers.map(([key, value]) => (
54 <tr> 52 <tr>
55 <td>{key}</td> 53 <td>{key}</td>
56 <td>{value}</td> 54 <td>{value}</td>
diff --git a/src/hooks/useRequests.tsx b/src/hooks/useRequests.tsx
index cb85162..204877a 100644
--- a/src/hooks/useRequests.tsx
+++ b/src/hooks/useRequests.tsx
@@ -1,15 +1,12 @@
1import {useCallback, useEffect, useMemo, useState} from "react"; 1import {useCallback, useEffect, useMemo, useState} from "react";
2import {getHost} from "../utils"; 2import {getHost} from "../utils";
3 3
4type Dict = { 4export type Headers = [string, string][]
5 [key: string]: string
6}
7 5
8export interface RequestPayload { 6export interface RequestPayload {
9 id: string 7 id: string
10 body: string 8 body: string
11 cookies: Dict 9 headers: Headers
12 headers: Dict
13 method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' 10 method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
14 path: string 11 path: string
15} 12}
@@ -23,8 +20,7 @@ export interface ResponsePayload {
23 id: string 20 id: string
24 timing: number 21 timing: number
25 body: string 22 body: string
26 cookies: Dict 23 headers: Headers
27 headers: Dict
28 status: number 24 status: number
29} 25}
30 26