diff --git a/package.json b/package.json index c4ee94b..4ad9829 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": false, "name": "bluelib", - "version": "0.11.3", + "version": "0.11.4", "license": "AGPL-3.0-or-later", "source": "src/index.js", "main": "dist/index.js", diff --git a/src/hooks/useRoyalnetData.js b/src/hooks/useRoyalnetData.js index cf0beb5..59ecc77 100644 --- a/src/hooks/useRoyalnetData.js +++ b/src/hooks/useRoyalnetData.js @@ -7,10 +7,11 @@ import useDeepCompareEffect from "use-deep-compare-effect"; export default function(method, path, body) { const instanceUrl = useContext(RoyalnetInstanceUrl); const [data, setData] = useState(undefined); + const [error, setError] = useState(undefined); useDeepCompareEffect(() => { - royalnetApiRequest(instanceUrl, method, path, body).then(d => setData(d)); + royalnetApiRequest(instanceUrl, method, path, body).then(d => setData(d)).catch((e => setError(e))); }, [instanceUrl, method, path, body]); - return data; + return [data, error]; }