refactor: Services nach Datenquelle getrennt – webservice/, database/ und utils/ Struktur eingeführt (v1.1.117)

This commit is contained in:
ISA
2025-05-20 13:27:20 +02:00
parent e3b8f7f0fc
commit 2846bc0b13
17 changed files with 29 additions and 10 deletions

View File

@@ -0,0 +1,18 @@
// services/api/fetchWithTimeout.js
const fetchWithTimeout = (url, options, timeout = 5000) => {
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), timeout);
return fetch(url, { ...options, signal: controller.signal })
.then((response) => {
clearTimeout(id);
return response;
})
.catch((error) => {
clearTimeout(id);
throw error;
});
};
export default fetchWithTimeout;