This commit is contained in:
seb
2026-07-31 20:37:43 +02:00
parent d5d30fb286
commit 9582370b0b
15 changed files with 174 additions and 70 deletions

20
src/utils/notify.js Normal file
View File

@@ -0,0 +1,20 @@
import { enqueueSnackbar } from 'notistack';
import { backendErrorFrom } from './backendError';
/** Show error toast and log to console for debugging. */
export function notifyError(err) {
const normalized = backendErrorFrom(err);
console.error('[error]', normalized.message, {
status: normalized.status,
path: normalized.path,
method: normalized.method,
err,
});
enqueueSnackbar(normalized.message, { variant: 'error' });
return normalized;
}
export function notifyErrorMessage(message) {
console.error('[error]', message);
enqueueSnackbar(message, { variant: 'error' });
}