
I am trying to update array of images but all i got its just amtpy arrayin appwrite but my Json data has Array of images And Theres no errors photos : [ "https://appwrite.homesapp.ru/v1/storage/buckets/6555e8fcbfa39471492a/files/magazinesScroll-image-1--1646138978/view?project=65140369acf5f3040759", "https://appwrite.homesapp.ru/v1/storage/buckets/6555e8fcbfa39471492a/files/magazinesScroll-image-0--1646138978/view?project=65140369acf5f3040759" ]

Can you show the code?

yeah

const { mutate: updateData, reset, } = useMutation({ mutationFn: async (newGalData: GalaryScrollBlock | null | undefined) => { console.log(newGalData) if (newGalData) { // console.log(newGalData) const dataId = newGalData.map((item) => { return item.$id })
const filteredVals = newGalData.map((item) => {
// console.log(itemPhoto)
const newData: any = {
mainPhoto: item.mainPhoto,
photos: item.photos,//item.photos
// photos:
price: Number(item.price),
features: item.features,
description: item.description || '',
status: item.status,
location: item.location
}
return newData
})
console.log(filteredVals)
// Promise.all(filteredVals.map())
filteredVals.map((item, i) => { return api.updateGalaryScroll(filteredVals[i], dataId[i]) })
// .then(alert);
// console.log(filteredVals)
}
},
onSuccess: () => {
alert('Success')
setTimeout(reset, 2000)
},
onError: (error) => {
console.log(error)
}
})

val.posterPhotos.map(async (valImageFile: File, i: number) => {
const fileId = magazinesScroll-image-${i}-${hash}
console.log(val)
await api
.uploadGalaryImage(fileId, valImageFile)
.then((res) => {
const imageView = api.sdk.storage.getFileView(api.galaryImagesBucket, fileId)
console.log(val)
// delete val.photos
// if (val.photos != undefined) {
// imageView.href
// val!.photos = imageView.href
// }
// val?.photos = imageView.href
val?.photos.push(imageView.href)
})
.catch((err) => {
hasErrors = true
form.setFieldError(`data.${i}.posterFile`, err.message)
})
.finally(() => {
setPostersUploadingId(-1)
delete val.posterPhotos
})
})



FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.

Please share the code for updateGalaryScroll()

Recommended threads
- I have an error oauth with Microsoft
invalid_request: The provided value for the input parameter 'redirect_uri' is not valid. The expected value is a URI which matches a redirect URI registered for...
- how many Teams can be created?
I am creating an app where I will let users create groups. This could mean there will be many groups created by user, to isolate those groups properly I am thin...
- React native app login via Safari
Hi! I deployed for debug my React Native app in web, chrome everythink works well but in safari on mac and ios I cant login. I found this one error in safari co...
