Site Search Update

This commit is contained in:
headlesdev
2025-05-20 17:40:29 +02:00
parent cd014f7de0
commit d1a289c4fa
6 changed files with 76 additions and 42 deletions

View File

@@ -3,14 +3,14 @@ import { Network } from "@/app/types";
const useNetworks = () => {
const addNetwork = (network: Network): Promise<string> | string => {
const addNetwork = (network: Network): Promise<Network> | string => {
if (!network.name) {
return 'Network name is required';
}
return axios.post('/api/sites/networks/add', network)
.then(() => {
return "Network added successfully";
.then((response) => {
return response.data.network;
})
.catch(err => {
throw err.response?.data?.error || 'An error occurred';