clean
This commit is contained in:
38
internal/api-harness/src/components/ApiResponse.jsx
Normal file
38
internal/api-harness/src/components/ApiResponse.jsx
Normal file
@@ -0,0 +1,38 @@
|
||||
const ApiResponse = ({ response, error, loading }) => {
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="mt-4">
|
||||
<h3 className="text-lg font-semibold text-slate-800 mb-2">Response</h3>
|
||||
<div className="bg-slate-100 border border-slate-200 rounded-lg p-4">
|
||||
<p className="text-slate-500">Loading...</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="mt-4">
|
||||
<h3 className="text-lg font-semibold text-red-800 mb-2">Error</h3>
|
||||
<pre className="bg-red-50 border border-red-200 text-red-700 rounded-lg p-4 text-sm whitespace-pre-wrap">
|
||||
{JSON.stringify(error, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (response) {
|
||||
return (
|
||||
<div className="mt-4">
|
||||
<h3 className="text-lg font-semibold text-slate-800 mb-2">Response</h3>
|
||||
<pre className="bg-slate-100 border border-slate-200 rounded-lg p-4 text-sm whitespace-pre-wrap">
|
||||
{JSON.stringify(response, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export default ApiResponse;
|
||||
Reference in New Issue
Block a user