From bb469d48477eecacca25ef9462afc644c982e8c0 Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Thu, 20 May 2021 21:37:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dck=E5=90=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/cookie.ts | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/back/services/cookie.ts b/back/services/cookie.ts index fb84b6df..5ecce83f 100644 --- a/back/services/cookie.ts +++ b/back/services/cookie.ts @@ -284,13 +284,31 @@ export default class CookieService { } public async disabled(_id: string) { - this.cronDb.update({ _id }, { $set: { status: CookieStatus.disabled } }); - await this.set_cookies(); + return new Promise((resolve) => { + this.cronDb.update( + { _id }, + { $set: { status: CookieStatus.disabled } }, + {}, + async (err) => { + await this.set_cookies(); + resolve(true); + }, + ); + }); } public async enabled(_id: string) { - this.cronDb.update({ _id }, { $set: { status: CookieStatus.noacquired } }); - await this.set_cookies(); + return new Promise((resolve) => { + this.cronDb.update( + { _id }, + { $set: { status: CookieStatus.noacquired } }, + {}, + async (err, num) => { + await this.set_cookies(); + resolve(true); + }, + ); + }); } public async set_cookies() {