I created the database and collection on 25 July.
users collection has-
accountId, username, email, password, avatar, address
products collection has-
title, description, category, imageA, imageB, users(relationship with users)
My submit function is like this-
const submit = () => {
const updatedProductData = {
title: form.title,
description: form.description,
category: form.category,
imageA: form.imageA,
imageB: form.imageB,
};
// Update the product document
await updateProductDocument(form.productId, updatedProductData);
} And appwrite function is - [export const updateProductDocument = async (productId, updatedData) => {
try {
await databases.updateDocument(
'your_database_id',
'your_collection_id',
productId,
dataToUpdate
);
} catch (error) {
console.error('Failed to update product document:', error.message);
throw error;
}
};]