aboutsummaryrefslogtreecommitdiff
path: root/src/useFetch.js
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-08-31 12:31:25 -0400
committerGalen Guyer <galen@galenguyer.com>2022-08-31 12:31:25 -0400
commite9b9cd2cd88e453a3a35cf3f672ba965660b9ff2 (patch)
treedf34e0aa8ffbc51fc14cbb1065437ba87e7b490f /src/useFetch.js
parent3ce7ae5c53705c213b293bb7bca833b066c14d6a (diff)
Update the dashboard with a message about the lack of any dashboards
Diffstat (limited to 'src/useFetch.js')
-rw-r--r--src/useFetch.js17
1 files changed, 0 insertions, 17 deletions
diff --git a/src/useFetch.js b/src/useFetch.js
deleted file mode 100644
index d098e2f..0000000
--- a/src/useFetch.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { useEffect, useState } from "react";
-
-export default function useFetch(url, options) {
- const [data, setData] = useState(null);
- const [loading, setLoading] = useState(true);
- const [error, setError] = useState(null);
-
- useEffect(() => {
- fetch(url, options)
- .then((resp) => resp.json())
- .then((resp) => setData(resp))
- .catch((err) => setError(err))
- .finally(() => setLoading(false));
- }, []);
-
- return { data, loading, error };
-}