aboutsummaryrefslogtreecommitdiff
path: root/paste-ui/src/list.js
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2023-01-01 20:09:08 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2023-01-01 20:09:08 -0500
commitfa6f3d619e6051d508d9f40c601f77f9b05e1784 (patch)
tree271bbceea5ebfb9face8ba8f02457f51044361f2 /paste-ui/src/list.js
parent1d63eabf1fca2d9e2477055e1be67e6f6c9b4b1b (diff)
downloadpaste-fa6f3d619e6051d508d9f40c601f77f9b05e1784.tar.gz
paste-fa6f3d619e6051d508d9f40c601f77f9b05e1784.tar.xz
Remove react UI
Diffstat (limited to 'paste-ui/src/list.js')
-rw-r--r--paste-ui/src/list.js46
1 files changed, 0 insertions, 46 deletions
diff --git a/paste-ui/src/list.js b/paste-ui/src/list.js
deleted file mode 100644
index 9371367..0000000
--- a/paste-ui/src/list.js
+++ /dev/null
@@ -1,46 +0,0 @@
-import { useState } from "react";
-import { useEffect } from "react";
-
-
-export default function List() {
- const [error, setError] = useState(null);
- const [isLoaded, setIsLoaded] = useState(false);
- const [items, setItems] = useState([]);
-
- // Note: the empty deps array [] means
- // this useEffect will run once
- // similar to componentDidMount()
- useEffect(() => {
- fetch("http://localhost:6130/api/v1/list")
- .then(res => res.json())
- .then(
- (result) => {
- setIsLoaded(true);
- setItems(result);
- },
- // Note: it's important to handle errors here
- // instead of a catch() block so that we don't swallow
- // exceptions from actual bugs in components.
- (error) => {
- setIsLoaded(true);
- setError(error);
- }
- )
- }, [])
-
- if (error) {
- return <div>Error: {error.message}</div>;
- } else if (!isLoaded) {
- return <div>Loading...</div>;
- } else {
- return (
- <ul>
- {items.map(item => (
- <li>
- ID: {item.id} Size: {item.size}
- </li>
- ))}
- </ul>
- );
- }
-} \ No newline at end of file