Skip to content

Commit 09809cb

Browse files
chore(api): replace remove with deleteone
remove is no longer supported
1 parent c79df93 commit 09809cb

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

api/src/services/auth.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,19 @@ const checkAuthorization = async ({
8787
const signerAddress = recoverAddressEIP712(typedData, signature);
8888
if (signerAddress === NULL_ADDRESS) throw Error('Null signerAddress');
8989
log('signerAddress', signerAddress);
90-
if (signerAddress.toLowerCase() !== address.toLowerCase())
90+
91+
if (signerAddress.toLowerCase() !== address.toLowerCase()) {
9192
throw new AuthError('Failed to verify signer, addresses mismatch.');
92-
await current.remove();
93-
return {
94-
address,
95-
chainId,
96-
};
93+
}
94+
95+
await ChallengeModel.deleteOne({ _id: current._id });
96+
97+
return { address, chainId };
9798
} catch (e) {
9899
log('checkAuthorization() error', e);
99-
throw e;
100+
throw e instanceof AuthError
101+
? e
102+
: new AuthError('Authorization check failed');
100103
}
101104
};
102105

api/src/services/order.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ const unpublishOrders = async ({
13471347
default:
13481348
throw new InternalError('unsupported target');
13491349
}
1350-
await Promise.all(ordersToUnpublish.map((e) => e.delete()));
1350+
await Promise.all(ordersToUnpublish.map((e) => e.deleteOne()));
13511351
return ordersToUnpublish.map((e) => e.toJSON());
13521352
};
13531353

0 commit comments

Comments
 (0)