diff --git a/www/utils/api.js b/www/utils/api.js index 4b1c08b..10281d8 100644 --- a/www/utils/api.js +++ b/www/utils/api.js @@ -29,16 +29,17 @@ export const callAPI = async (ctxOrNull, { url, method, data }) => { else return response.data.body } -export const useCallAPI = (call) => { +export const useCallAPI = (call, automatic = false) => { const [data, setData] = useState(undefined) const refresh = () => { callAPI(null, call).then(setData) } - useEffect(() => { - refresh() - }, [0]) + if (automatic) + useEffect(() => { + refresh() + }, [0]) return [data, refresh] } \ No newline at end of file