checking if inventory is undefined

This commit is contained in:
Miodec 2022-09-06 17:02:35 +02:00
parent fada34500d
commit 9e7e0fc6ff

View file

@ -730,16 +730,19 @@ export async function updateProfile(
value === undefined || (_.isPlainObject(value) && _.isEmpty(value))
);
const updates = {
$set: {
...profileUpdates,
inventory,
},
};
if (inventory === undefined) delete updates.$set.inventory;
await getUsersCollection().updateOne(
{
uid,
},
{
$set: {
...profileUpdates,
inventory,
},
}
updates
);
}