This is my productSlice "export const updateProductById = createAsyncThunk(…
- User
This is my productSlice "export const updateProductById = createAsyncThunk( 'products/updateProductById', async ({ productId, product_Name, product_Description, product_Price, product_Stock, product_isSale,category_Name,imageGallery_Id,images }) => { const updatedProduct = await updateProduct(productId, { product_Name, product_Description, product_Price, product_Stock, product_isSale, category_Name, imageGallery_Id, images, }); return updatedProduct; } );" I need to modify images to remove the domain and port from the passed parameters, how to do it
- Assistant
To modify the
imagesparameter to remove the domain and port before passing it to theupdateProductfunction within yourupdateProductByIdthunk, you can use URL parsing to extract the path from each image URL. Here's how you can do it:- Parse each image URL to extract the path.
- Modify the
imagesarray in place before passing it to the function.