mirror of
https://github.com/Steffo99/bluelib.git
synced 2024-12-22 19:44:21 +00:00
0.11.4
This commit is contained in:
parent
4397eb18fb
commit
ba939a23a7
2 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"private": false,
|
"private": false,
|
||||||
"name": "bluelib",
|
"name": "bluelib",
|
||||||
"version": "0.11.3",
|
"version": "0.11.4",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"source": "src/index.js",
|
"source": "src/index.js",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|
|
@ -7,10 +7,11 @@ import useDeepCompareEffect from "use-deep-compare-effect";
|
||||||
export default function(method, path, body) {
|
export default function(method, path, body) {
|
||||||
const instanceUrl = useContext(RoyalnetInstanceUrl);
|
const instanceUrl = useContext(RoyalnetInstanceUrl);
|
||||||
const [data, setData] = useState(undefined);
|
const [data, setData] = useState(undefined);
|
||||||
|
const [error, setError] = useState(undefined);
|
||||||
|
|
||||||
useDeepCompareEffect(() => {
|
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]);
|
}, [instanceUrl, method, path, body]);
|
||||||
|
|
||||||
return data;
|
return [data, error];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue