u
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
import { bootstrapSession as bootstrapSessionThunk } from '../store/authSlice';
|
||||
import { notifyError } from '../utils/notify';
|
||||
|
||||
let sessionBootstrapped = false;
|
||||
|
||||
@@ -19,7 +19,7 @@ class AuthBootstrap extends Component {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
enqueueSnackbar(`Session check failed: ${err.message}`, { variant: 'error' });
|
||||
notifyError(err);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ import { connect } from 'react-redux';
|
||||
import Box from '@mui/material/Box';
|
||||
import Button from '@mui/material/Button';
|
||||
import GoogleIcon from '@mui/icons-material/Google';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
import { loginWithGoogle, selectAuthStatus, selectGoogleClientId } from '../store/authSlice';
|
||||
import { notifyErrorMessage } from '../utils/notify';
|
||||
import {
|
||||
abortGoogleSignIn,
|
||||
FEDCM_BLOCKED_MESSAGE,
|
||||
|
||||
@@ -3,6 +3,7 @@ import ContentPasteIcon from '@mui/icons-material/ContentPaste';
|
||||
import { article } from '../../api';
|
||||
import { PanelTile } from '../panels';
|
||||
import { requireObject } from '../../utils/apiShape';
|
||||
import { notifyError } from '../../utils/notify';
|
||||
import { prepareArticlePhoto } from '../../utils/prepareArticlePhoto';
|
||||
import { pasteImageOrFallback } from '../../utils/pasteImage';
|
||||
import { primaryPhoto } from '../../utils/articleDetail';
|
||||
@@ -25,10 +26,12 @@ export default function ArticlePhotoTile({
|
||||
setBusy(true);
|
||||
try {
|
||||
const file = await prepareArticlePhoto(rawBlob);
|
||||
const res = await article.uploadPhoto(articleData.sku, file);
|
||||
requireObject(res, 'POST /api/article/:sku/photos');
|
||||
const res = await article.uploadImage(articleData.sku, file);
|
||||
requireObject(res, 'POST /api/article/:sku/image');
|
||||
requireObject(res.article, 'article');
|
||||
onArticleUpdated?.(res.article);
|
||||
} catch (err) {
|
||||
notifyError(err);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import Paper from '@mui/material/Paper';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { injectMuiTheme } from './injectMuiTheme';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
import { backendErrorFrom } from '../../utils/backendError';
|
||||
import { notifyError } from '../../utils/notify';
|
||||
import { panelTilePaperSx, TILE_ACTION_PADDING, tileActionIconSx, tileActionSx } from './panelTileLayout';
|
||||
|
||||
function valuesEqual(a, b) {
|
||||
@@ -113,9 +113,8 @@ class EditablePanelTileBase extends Component {
|
||||
this.setState({ editing: false, draft: null, saving: false, error: null });
|
||||
enqueueSnackbar('Gespeichert.', { variant: 'success' });
|
||||
} catch (err) {
|
||||
const normalized = backendErrorFrom(err);
|
||||
const normalized = notifyError(err);
|
||||
this.setState({ saving: false, error: normalized.message });
|
||||
enqueueSnackbar(normalized.message, { variant: 'error' });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user