mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Edit Site alerts
This commit is contained in:
@@ -24,14 +24,21 @@ const useSite = () => {
|
||||
loadSite();
|
||||
}, [loadSite]);
|
||||
|
||||
const editSite = (site: Site) => {
|
||||
const editSite = (site: Site): string | void => {
|
||||
if (!site.id) {
|
||||
return 'Site ID is required';
|
||||
}
|
||||
|
||||
if(site.name.length < 3) {
|
||||
return 'Site name must be at least 3 characters long';
|
||||
}
|
||||
axios.post('/api/sites/edit', site)
|
||||
.then(() => {
|
||||
console.log("Site edited successfully");
|
||||
return;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
})
|
||||
return err.response?.data?.error || 'An error occurred';
|
||||
});
|
||||
};
|
||||
|
||||
const deleteSite = (siteId: string) => {
|
||||
|
||||
Reference in New Issue
Block a user