frontend: table addition elements refactor
This commit is contained in:
@@ -71,7 +71,6 @@ const useFetchHosting = () => {
|
||||
};
|
||||
|
||||
const createHosting = async (token: string, name: string, capacity: number) => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const response = await fetch(`${API_URL}/hosting/create`, {
|
||||
@@ -84,13 +83,13 @@ const useFetchHosting = () => {
|
||||
|
||||
if (!response.ok) { // Check for non-200 responses
|
||||
const errorText = await response.text(); // Capture the response text for further insights
|
||||
console.log(`Error ${response.status}: ${errorText}`)
|
||||
throw new Error(`Error ${response.status}: ${errorText}`);
|
||||
}
|
||||
|
||||
// Optional: Fetch the updated data after reservation
|
||||
//await fetchData();
|
||||
await fetchData();
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user