From fa6f3d619e6051d508d9f40c601f77f9b05e1784 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Sun, 1 Jan 2023 20:09:08 -0500 Subject: Remove react UI --- paste-ui/src/list.js | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 paste-ui/src/list.js (limited to 'paste-ui/src/list.js') 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
Error: {error.message}
; - } else if (!isLoaded) { - return
Loading...
; - } else { - return ( - - ); - } -} \ No newline at end of file -- cgit v1.2.3