Add images to the post in the right order

zio/stable
Paul Frazee 2023-01-17 18:35:48 -06:00
parent bccc8a64d0
commit 61682d5846
1 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ export const PhotoCarouselPicker = ({
...IMAGE_PARAMS, ...IMAGE_PARAMS,
}) })
const img = await compressIfNeeded(cameraRes, 300000) const img = await compressIfNeeded(cameraRes, 300000)
onSelectPhotos([img.path, ...selectedPhotos]) onSelectPhotos([...selectedPhotos, img.path])
} catch (err: any) { } catch (err: any) {
// ignore // ignore
store.log.warn('Error using camera', err) store.log.warn('Error using camera', err)
@ -68,7 +68,7 @@ export const PhotoCarouselPicker = ({
height, height,
}) })
const img = await compressIfNeeded(cropperRes, 300000) const img = await compressIfNeeded(cropperRes, 300000)
onSelectPhotos([img.path, ...selectedPhotos]) onSelectPhotos([...selectedPhotos, img.path])
} catch (err: any) { } catch (err: any) {
// ignore // ignore
store.log.warn('Error selecting photo', err) store.log.warn('Error selecting photo', err)
@ -102,7 +102,7 @@ export const PhotoCarouselPicker = ({
const finalImg = await compressIfNeeded(cropperRes, 300000) const finalImg = await compressIfNeeded(cropperRes, 300000)
result.push(finalImg.path) result.push(finalImg.path)
} }
onSelectPhotos([...result, ...selectedPhotos]) onSelectPhotos([...selectedPhotos, ...result])
}) })
}, [selectedPhotos, onSelectPhotos]) }, [selectedPhotos, onSelectPhotos])