diff --git a/package.json b/package.json index b8ac10a..c6c48c1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": false, "name": "bluelib", - "version": "0.11.5", + "version": "0.11.6", "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 59ecc77..cb70ba3 100644 --- a/src/hooks/useRoyalnetData.js +++ b/src/hooks/useRoyalnetData.js @@ -9,9 +9,15 @@ export default function(method, path, body) { const [data, setData] = useState(undefined); const [error, setError] = useState(undefined); + function refresh() { + setData(undefined); + setError(undefined); + royalnetApiRequest(instanceUrl, method, path, body).then(d => setData(d)).catch((e => setError(e))); + } + useDeepCompareEffect(() => { royalnetApiRequest(instanceUrl, method, path, body).then(d => setData(d)).catch((e => setError(e))); }, [instanceUrl, method, path, body]); - return [data, error]; + return [data, error, refresh]; }