From 2ddad00cb71402483e75b637d48e051002600cab Mon Sep 17 00:00:00 2001 From: Anna Tsybel Date: Mon, 24 Jun 2024 01:14:01 +0300 Subject: [PATCH] hello --- web/src/api/users.ts | 2 +- web/src/app/store/reducers/categories.ts | 12 ++++++++++++ web/src/app/views/ProductPage/Create/index.tsx | 5 +++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/web/src/api/users.ts b/web/src/api/users.ts index 2e7afe8..c7fd8db 100644 --- a/web/src/api/users.ts +++ b/web/src/api/users.ts @@ -2,7 +2,7 @@ import { APIClient } from '.'; import { User, UserRegisterData, UserUpdateData } from '@/users'; import { Product } from '@/product'; -const MOCK_ADMIN = 0; +const MOCK_ADMIN = 1; /** * UsersClient is a http implementation of users API. diff --git a/web/src/app/store/reducers/categories.ts b/web/src/app/store/reducers/categories.ts index 5bb0b56..3c74256 100644 --- a/web/src/app/store/reducers/categories.ts +++ b/web/src/app/store/reducers/categories.ts @@ -45,4 +45,16 @@ export const categoriesSlice = createSlice({ // Action creators are generated for each case reducer function export const { } = categoriesSlice.actions; + + + + export default categoriesSlice.reducer; + + + + + + + + diff --git a/web/src/app/views/ProductPage/Create/index.tsx b/web/src/app/views/ProductPage/Create/index.tsx index acc1878..cb7728f 100644 --- a/web/src/app/views/ProductPage/Create/index.tsx +++ b/web/src/app/views/ProductPage/Create/index.tsx @@ -40,7 +40,7 @@ const ProductCreate = () => { const productPhotos: string[] | [] = useAppSelector((state: RootState) => state.productsReducer.productPhotos); const subsubcategories: SubSubCategory[] | [] = useAppSelector((state: RootState) => state.categoriesReducer.allSubSubcategories); - const handleFileChange = async(e: ChangeEvent) => { + const handleFileChange = async (e: ChangeEvent) => { if (e.target.files?.length) { const photosData = []; const filesData = []; @@ -51,6 +51,7 @@ const ProductCreate = () => { photosData.push(URL.createObjectURL(uploadedFile)); const convertedFile: string = await convertToBase64(uploadedFile); + console.log(convertedFile) filesData.push(convertedFile.split(',')[SECOND_INDEX]); } @@ -59,7 +60,7 @@ const ProductCreate = () => { } }; - const createProduct = async() => { + const createProduct = async () => { try { await dispatch(create(new ProductCreation( title,