diff --git a/hooks/useNetworks.ts b/hooks/useNetworks.ts index 4d98d2f..c150d2a 100644 --- a/hooks/useNetworks.ts +++ b/hooks/useNetworks.ts @@ -48,10 +48,21 @@ const useNetworks = () => { }); }; + const getAllNetworks = (): Promise | string => { + return axios.get('/api/sites/networks/get_all') + .then((response) => { + return response.data.networks; + }) + .catch(err => { + throw err.response?.data?.error || 'An error occurred'; + }); + }; + return { addNetwork, editNetwork, deleteNetwork, + getAllNetworks, }; };