mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-06 11:01:00 +08:00
checking if inventory is undefined
This commit is contained in:
parent
fada34500d
commit
9e7e0fc6ff
1 changed files with 9 additions and 6 deletions
|
|
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue