diff --git a/frontend/shop/src/app.tsx b/frontend/shop/src/app.tsx index 390658b..f8a3e2a 100644 --- a/frontend/shop/src/app.tsx +++ b/frontend/shop/src/app.tsx @@ -2,15 +2,19 @@ import { Container, CssBaseline, ThemeProvider } from '@mui/material' import { Shop } from './pages/shop' import { blue } from '@mui/material/colors' import { theme } from './theme' +import { Provider } from 'react-redux' +import { store } from './store' export const App = () => { return ( <> - - - + + + + + ) diff --git a/frontend/shop/src/pages/shop/shop-slice.ts b/frontend/shop/src/pages/shop/shop-slice.ts index 8b87484..bb88e0b 100644 --- a/frontend/shop/src/pages/shop/shop-slice.ts +++ b/frontend/shop/src/pages/shop/shop-slice.ts @@ -21,9 +21,10 @@ export const shopSlice = createSlice({ name: 'shop', initialState, reducers: { + // TODO: дописать action.payload.id addToBasket: (state, action: PayloadAction) => { - state.products[action.payload.id].count -= action.payload.count - state.products[action.payload.id].reserved += action.payload.count + state.products[0].count -= action.payload.count + state.products[0].reserved += action.payload.count }, }, extraReducers: builder => { diff --git a/frontend/shop/src/pages/shop/shop.tsx b/frontend/shop/src/pages/shop/shop.tsx index 8cda6ab..93e2a1e 100644 --- a/frontend/shop/src/pages/shop/shop.tsx +++ b/frontend/shop/src/pages/shop/shop.tsx @@ -1,4 +1,4 @@ -import { memo, useCallback, useEffect, type JSX } from 'react' +import { memo, useCallback, useEffect } from 'react' import styles from './shop.module.css' import { Box, Button } from '@mui/material' import { useAppDispatch, useAppSelector } from '../../hooks' @@ -22,7 +22,7 @@ export const Shop = memo(() => { - {String(products)} + {JSON.stringify(products)} ) })