Changed then to await.

This commit is contained in:
Jeffrey Phillips Freeman 2024-03-06 19:50:14 -05:00
parent 87a1458858
commit bb57253ff0
No known key found for this signature in database
GPG key ID: AD914585C9406B6A

View file

@ -42,10 +42,10 @@ export default async function (req: VercelRequest, res: VercelResponse) {
let sentIds = [];
if ( (!config.exists) || (configData == undefined) ) {
// Config doesn't exist, make something
configRef.set({
await configRef.set({
"sentIds": [],
"lastEpoch": ""
}).then(result => response.status(200));
});
} else {
if( configData.sentIds.length > 0 ) {
sentIds.push(...configData.sentIds);
@ -59,10 +59,10 @@ export default async function (req: VercelRequest, res: VercelResponse) {
res.status(401).end("Function is rate limited, please wait")
return;
} else {
configRef.set({
await configRef.set({
"sentIds": sentIds,
"lastEpoch": new Date().getTime()
}).then(result => response.status(200));
});
}
}
@ -119,10 +119,10 @@ export default async function (req: VercelRequest, res: VercelResponse) {
if( sendingIds.size > 0 ) {
newSentIds.push(...sendingIds);
}
configRef.set({
await configRef.set({
"sentIds": newSentIds,
"lastEpoch": new Date().getTime()
}).then(result => response.status(200));
});
console.log("sendNode successful", sentIds, sendingIds, newSentIds);