frontend: table addition elements refactor

This commit is contained in:
tylen
2025-11-02 21:45:12 +02:00
parent c39384badf
commit 27ee5d59c3
3 changed files with 46 additions and 55 deletions

View File

@@ -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);
}
};