fix wrong id read
This commit is contained in:
parent
a0a2cd46ac
commit
59b31c0201
|
|
@ -9,6 +9,7 @@ import { AppState } from "../../reducers";
|
|||
import CodeEditor from "./CodeEditor";
|
||||
import { ActionResponse } from "../../api/ActionAPI";
|
||||
import { formatBytes } from "../../utils/helpers";
|
||||
import { APIEditorRouteParams } from "constants/routes";
|
||||
|
||||
const ResponseWrapper = styled.div`
|
||||
position: relative;
|
||||
|
|
@ -91,10 +92,27 @@ const ResponseHeadersView = (props: { data: Record<string, string[]> }) => {
|
|||
);
|
||||
};
|
||||
|
||||
type Props = ReduxStateProps & RouteComponentProps<{ id: string }>;
|
||||
type Props = ReduxStateProps & RouteComponentProps<APIEditorRouteParams>;
|
||||
|
||||
const EMPTY_RESPONSE = {
|
||||
statusCode: "",
|
||||
duration: "",
|
||||
body: {},
|
||||
headers: {},
|
||||
size: "",
|
||||
};
|
||||
|
||||
const ApiResponseView = (props: Props) => {
|
||||
const response = props.responses[props.match.params.id] || {};
|
||||
const {
|
||||
match: {
|
||||
params: { apiId },
|
||||
},
|
||||
responses,
|
||||
} = props;
|
||||
let response: ActionResponse = EMPTY_RESPONSE;
|
||||
if (apiId && apiId in responses) {
|
||||
response = responses[apiId];
|
||||
}
|
||||
return (
|
||||
<ResponseWrapper>
|
||||
{props.isRunning && <LoadingScreen>Sending Request</LoadingScreen>}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import React from "react";
|
||||
import _ from "lodash";
|
||||
import BaseControl, { ControlProps } from "./BaseControl";
|
||||
import { ControlWrapper, StyledInputGroup } from "./StyledControls";
|
||||
import { InputType } from "../../widgets/InputWidget";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user