#3 - исправление NPE для загрузки фото
This commit is contained in:
@@ -16,6 +16,7 @@ import {requests} from "../../../requests";
|
||||
import {api} from "../../../lib/clients/api";
|
||||
import {useAlert} from "../../../hooks/useAlert";
|
||||
import {CocktailInfoModal} from "../../../components/cocktails/CocktailInfoModal";
|
||||
import {useSelect} from "../../../hooks/useSelect";
|
||||
|
||||
export function CocktailMenuBarPage() {
|
||||
const {createError} = useAlert();
|
||||
@@ -23,8 +24,7 @@ export function CocktailMenuBarPage() {
|
||||
const [findString, setFindString] = useState("");
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [cocktails, setCocktails] = useState([]);
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
const [selected, setSelected] = useState(null);
|
||||
const {setCocktail, state} = useSelect();
|
||||
|
||||
useEffect(() => {
|
||||
api().get(`${requests.cocktails.menu}?all=true`)
|
||||
@@ -38,12 +38,11 @@ export function CocktailMenuBarPage() {
|
||||
|
||||
|
||||
const handleOpenModal = (row) => {
|
||||
setSelected(row)
|
||||
setOpenModal(true);
|
||||
setCocktail(row);
|
||||
}
|
||||
const changeHandler = (row, value) => {
|
||||
const newState = cocktails.map((r) => {
|
||||
if(r.id !== row.id) {
|
||||
if (r.id !== row.id) {
|
||||
return r;
|
||||
}
|
||||
return {
|
||||
@@ -117,11 +116,7 @@ export function CocktailMenuBarPage() {
|
||||
{/*Загрузчик*/}
|
||||
<Loading loading={loading}/>
|
||||
{/*Модальное окно информации об ингредиенте*/}
|
||||
<CocktailInfoModal open={openModal} row={selected}
|
||||
closeHandler={() => {
|
||||
setSelected(null);
|
||||
setOpenModal(false);
|
||||
}}/>
|
||||
<CocktailInfoModal row={state.cocktail}/>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user