Skip to content

Commit

Permalink
Fix typescript highlight warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
limemloh committed Dec 8, 2023
1 parent 80ec733 commit 13a2a5d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/mainnet/net/guides/gallery/gallery-frontend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ When the page is initially opened, it displays the items of the gallery but with
To do that the names of the items must be fetched from the backend. To fetch the items from the backend the `api/names` endpoint of the backend is used. Below is a snippet that shows how the `Gallery` component does that when it loads, given that ``getNames`` is a function that fetches the names from the backend.

.. code-block:: typescript
:force:
interface ItemData {
name: string;
Expand All @@ -19,15 +20,15 @@ To do that the names of the items must be fetched from the backend. To fetch the
export default function Gallery() {
const [items, setItems] = useState<ItemData[]>([]);
...
// ...
useEffect(() => {
getNames(VERIFIER_URL).then((names) =>
setItems(names.map((name) => (
{ name, location: `${VERIFIER_URL}/image/${name}`}
)))
);
}, []);
...
// ...
}
Then there is a component to show the items. In addition to taking the ``itemData`` as input, it also takes the ``authToken`` needed to access the images as an optional parameter, and when it is present, the component fetches the image at the location with the token:
Expand Down

0 comments on commit 13a2a5d

Please sign in to comment.