Skip to content
Open

test #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/src/api/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions web/src/app/store/reducers/categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;








5 changes: 3 additions & 2 deletions web/src/app/views/ProductPage/Create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLInputElement>) => {
const handleFileChange = async (e: ChangeEvent<HTMLInputElement>) => {
if (e.target.files?.length) {
const photosData = [];
const filesData = [];
Expand All @@ -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]);
}

Expand All @@ -59,7 +60,7 @@ const ProductCreate = () => {
}
};

const createProduct = async() => {
const createProduct = async () => {
try {
await dispatch(create(new ProductCreation(
title,
Expand Down