mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 15:36:50 +00:00
getAllNetworks Hook
This commit is contained in:
parent
ed4a607373
commit
9a797194a2
@ -48,10 +48,21 @@ const useNetworks = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const getAllNetworks = (): Promise<Network[]> | 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,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user