Hi, every time I try to update an entry it creates a new obj in moralis. Any clues? Is there something similar to setUserData
also for for classes? What am I missing? Thanks
Code explanation:
After submitting a form I need to save a new object if it doesnβt exist, or to update it if it exists.
const onSubmit = ({ instagram_profile, youtube_url, about }) => {
setSaveIsLoading(true);
save({
instagram_profile,
youtube_url,
about,
profile_photo: photo,
cover_photo: cover,
user_id: user.id,
})
.then(() => {
notifySuccess();
setSaveIsLoading(false);
setCover(null);
setPhoto(null);
})
.catch(() =>
notifyError('Error saving you profile page data. Try again.')
);
};
I tried also with plain JavaScript like this:
const Guides = Moralis.Object.extend('Guides');
const guide = new Guides();
guide.set({
instagram_profile,
youtube_url,
about,
profile_photo: photo,
cover_photo: cover,
first_name: user.attributes.first_name,
last_name: user.attributes.last_name,
user_id: user.id,
});
guide.save();
Here you are my Master! @ivan