From ba939a23a775c17883ba13c1a9df2ea1f4e9ebbf Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 19 Jun 2020 22:26:46 +0200 Subject: [PATCH] 0.11.4 --- package.json | 2 +- src/hooks/useRoyalnetData.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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]; }