Files
mfahampshire a336893116 Max/openapi docs (#5219)
* first pass redoc apis

* new landing + component update

* added intro

* new structure

* link list

* add sandbox sdk

* remove theme colours

* revert credit to ticket & ticketbook and actually get all the instances to replace

* Max/zknym doc tweak (#5223)

* revert credit to ticket & ticketbook

* revert credit to ticket & ticketbook and actually get all the instances to replace

* theme tweak to widen text area

* theme redoc component

* tweak padding topbar

* modified socks5 page to be in line with websocket client

* modify h size of autodoc generated command info

* tweak script to build from master

* add autodoc to workspace

* auto commit generated command files

* clean autodoc-generated-markdown in script

* auto commit generated command files

* tweak works

* clippy

* fix borked toml from cherrypick

* remove rm command

* auto commit generated command files

* blow away images

* auto commit generated command files

* remove redoc for nymapi for the moment but retain everything else

* fix double paste

* temp remove sandbox
2024-12-11 16:30:17 +00:00

53 lines
1.2 KiB
TypeScript

import React, { useState, useEffect } from "react";
export default function NymDealersAddresses({
endpoint,
}: {
endpoint: string;
}) {
const [announceAddresses, setAnnounceAddresses] = useState<string[]>([]);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch(endpoint);
if (!response.ok) {
throw new Error("Failed to fetch data");
}
const jsonData = await response.json();
const addresses = jsonData.data.dealers.map(
(dealer: any) => dealer.announce_address
);
setAnnounceAddresses(addresses);
setIsLoading(false);
} catch (error) {
setError(error instanceof Error ? error.message : "Unknown error");
setIsLoading(false);
}
};
fetchData();
}, [endpoint]);
if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error}</div>;
return (
<table>
<tbody>
{announceAddresses.map((address, index) => (
<tr key={index}>
<a href={address}>{address}</a>
</tr>
))}
</tbody>
</table>
);
}