#3 - исправление NPE для загрузки фото
This commit is contained in:
@@ -37,6 +37,7 @@ function renderButtons(row, my, handleChange) {
|
||||
|
||||
export default function OrderModal({row, handleClose, open, handleChange, my}) {
|
||||
const [receipt, setReceipt] = useState([]);
|
||||
const [instructions, setInstructions] = useState();
|
||||
const {createError} = useAlert();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -46,6 +47,10 @@ export default function OrderModal({row, handleClose, open, handleChange, my}) {
|
||||
api().get(requests.bar.receipts + row.cocktail.id)
|
||||
.then((r) => setReceipt(r.data))
|
||||
.catch(() => createError("Ошибка получения рецепта"))
|
||||
|
||||
api().get(requests.cocktails.instructions + row.cocktail.id)
|
||||
.then((r) => setInstructions(r.data))
|
||||
.catch(() => createError("Ошибка получения инструкции"))
|
||||
// eslint-disable-next-line
|
||||
}, [row]);
|
||||
|
||||
@@ -62,7 +67,6 @@ export default function OrderModal({row, handleClose, open, handleChange, my}) {
|
||||
<DialogTitle>{"Заказ №" + row.id}</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText>{row.cocktail.name}</DialogContentText>
|
||||
<DialogContentText>{row.cocktail.alcoholic + " " + row.cocktail.category}</DialogContentText>
|
||||
<DialogContentText>{"для: " + row.visitor.name + " " + row.visitor.lastName}</DialogContentText>
|
||||
<Box noValidate component="form"
|
||||
sx={{display: 'flex', flexDirection: 'column', m: 'auto', width: 'fit-content',}}>
|
||||
@@ -74,8 +78,14 @@ export default function OrderModal({row, handleClose, open, handleChange, my}) {
|
||||
return (<Typography key={r.id}>{`${r.ingredient.name} - ${r.measure}`}</Typography>)
|
||||
})}
|
||||
</Stack>
|
||||
<Typography>Инструкция:</Typography>
|
||||
<Typography pl={1}>{row.cocktail.instructions}</Typography>
|
||||
{instructions &&
|
||||
(
|
||||
<>
|
||||
<Typography>Инструкция:</Typography>
|
||||
<Typography pl={1}>{instructions}</Typography>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
{row.cocktail.video && (<iframe width="350" /*height="315"*/
|
||||
src={row.cocktail.video}
|
||||
|
||||
Reference in New Issue
Block a user