mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-30 04:34:16 +02:00
Refactor desktop app into separate client and proxy apps
This commit is contained in:
22
apps/yaak-client/components/responseViewers/JsonViewer.tsx
Normal file
22
apps/yaak-client/components/responseViewers/JsonViewer.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import classNames from 'classnames';
|
||||
import { JsonAttributeTree } from '../core/JsonAttributeTree';
|
||||
|
||||
interface Props {
|
||||
text: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function JsonViewer({ text, className }: Props) {
|
||||
let parsed = {};
|
||||
try {
|
||||
parsed = JSON.parse(text);
|
||||
} catch {
|
||||
// Nothing yet
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={classNames(className, 'overflow-x-auto h-full')}>
|
||||
<JsonAttributeTree attrValue={parsed} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user