mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Network alerts
This commit is contained in:
@@ -21,20 +21,28 @@ export default function AddNetwork({ onNetworkAdded, siteId }: AddNetworkProps)
|
||||
const { addNetwork } = useNetworks();
|
||||
|
||||
const handleAddNetwork = () => {
|
||||
addNetwork({
|
||||
id: "0",
|
||||
siteId,
|
||||
name,
|
||||
ipv4Subnet,
|
||||
ipv6Subnet,
|
||||
gateway
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (onNetworkAdded) {
|
||||
onNetworkAdded();
|
||||
try {
|
||||
const response = addNetwork({
|
||||
id: "0",
|
||||
siteId,
|
||||
name,
|
||||
ipv4Subnet,
|
||||
ipv6Subnet,
|
||||
gateway
|
||||
});
|
||||
if (response) {
|
||||
setError(response)
|
||||
return
|
||||
}
|
||||
}, 500);
|
||||
setTimeout(() => {
|
||||
if (onNetworkAdded) {
|
||||
onNetworkAdded()
|
||||
setSuccess("Network added successfully")
|
||||
}
|
||||
}, 500);
|
||||
} catch (err) {
|
||||
setError("Failed to add network")
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user