mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-26 01:05:38 +00:00
Resolve https://projekte.kosit.org/kosit/validator/-/issues/97 "Replace docsify from UI"
This commit is contained in:
parent
a10cc14d06
commit
219aeaa1b7
100 changed files with 27369 additions and 1072 deletions
35
server/ui/src/components/XmlView/XmlView.tsx
Normal file
35
server/ui/src/components/XmlView/XmlView.tsx
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import React, { useEffect } from "react";
|
||||
import Codeblock from "../Codeblock";
|
||||
import ErrorDisplay from "../ErrorDisplay";
|
||||
import useRequest, { RequestStatus } from "../util/useRequest";
|
||||
|
||||
function XmlView({
|
||||
endpoint,
|
||||
fileName,
|
||||
}: {
|
||||
endpoint: string;
|
||||
fileName: string;
|
||||
}): JSX.Element {
|
||||
const { request, data, error, status } = useRequest();
|
||||
|
||||
useEffect(() => {
|
||||
request(endpoint, { headers: { "Content-Type": "application/xml" } });
|
||||
}, [endpoint, request]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{status === RequestStatus.Failure && error && (
|
||||
<ErrorDisplay title="An error occurred while fetching">
|
||||
<Codeblock>{error.message}</Codeblock>
|
||||
</ErrorDisplay>
|
||||
)}
|
||||
{status === RequestStatus.Success && data && (
|
||||
<Codeblock download={{ fileName, mime: "application/xml" }} enableCopy>
|
||||
{data}
|
||||
</Codeblock>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default XmlView;
|
||||
3
server/ui/src/components/XmlView/index.ts
Normal file
3
server/ui/src/components/XmlView/index.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import XmlView from "./XmlView";
|
||||
|
||||
export default XmlView;
|
||||
Loading…
Add table
Add a link
Reference in a new issue