mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
v2.5.0
This commit is contained in:
1 parent
0de7cd7b59
commit
7d7b12392f
18 files changed
+90
-47
No files matched your search
@@ -37,9 +37,9 @@ async function add(tokenType, expireSeconds, data) {
|
||||
* @param {number} tokenType type of the token.
|
||||
* @returns {Promise<object>} The token document, or null.
|
||||
*/
|
||||
async function get(tokenId, tokenType) {
|
||||
async function get(tokenId, tokenType, doThrow = true) {
|
||||
const res = await coll.findOne({ _id: tokenId, tokenType });
|
||||
if (!res) throw new ValidationError('token');
|
||||
if (!res && doThrow) throw new ValidationError('token');
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user