mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-28 04:11:16 +01:00
Add separate SVG response viewer
This commit is contained in:
14
src-web/components/responseViewers/SvgViewer.tsx
Normal file
14
src-web/components/responseViewers/SvgViewer.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
import React from 'react';
|
||||
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
|
||||
|
||||
interface Props {
|
||||
response: HttpResponse;
|
||||
}
|
||||
|
||||
export function SvgViewer({ response }: Props) {
|
||||
const rawTextBody = useResponseBodyText(response);
|
||||
if (rawTextBody.data == null) return null;
|
||||
const src = `data:image/svg+xml;base64,${btoa(rawTextBody.data)}`;
|
||||
return <img src={src} alt="Response preview" className="max-w-full max-h-full pb-2" />;
|
||||
}
|
||||
Reference in New Issue
Block a user