fix: suppress auto store refresh toast on reload

This commit is contained in:
2025-11-09 21:44:37 +01:00
parent 4b33efea47
commit ace0817b0f

View File

@@ -504,12 +504,14 @@ function App() {
}
}, [session?.token, authorizedFetch, normalizeConfigEntries]);
const fetchStoresList = useCallback(async (tokenOverride) => {
const fetchStoresList = useCallback(async (tokenOverride, { silent = false } = {}) => {
const tokenToUse = tokenOverride || session?.token;
if (!tokenToUse) {
return;
}
if (!silent) {
setStatus('');
}
setError('');
try {
const response = await authorizedFetch('/api/stores', {}, tokenToUse);
@@ -518,8 +520,10 @@ function App() {
}
const data = await response.json();
setStores(Array.isArray(data) ? data : []);
if (!silent) {
setStatus('Betriebe aktualisiert.');
setTimeout(() => setStatus(''), 3000);
}
} catch (err) {
setError(`Fehler beim Laden der Betriebe: ${err.message}`);
}
@@ -613,7 +617,7 @@ function App() {
}
}
await fetchStoresList(effectiveToken);
await fetchStoresList(effectiveToken, { silent: reason !== 'manual' });
await fetchConfig(effectiveToken, { silent: true });
setIsDirty(false);
setStatus('Betriebe aktualisiert.');