From ad9727075296b87f5713d0b8199eade5b68a0400 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 15 Oct 2024 17:20:25 +0700 Subject: [PATCH] =?UTF-8?q?fix=20noti=20=E0=B8=95=E0=B8=B4=E0=B8=94=20prom?= =?UTF-8?q?ise?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CommandController.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 85b2c98e..8f291634 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -1013,9 +1013,11 @@ export class CommandController extends Controller { if (command.commandExcecuteDate == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบวันที่คำสั่งมีผล"); - let profiles = command.commandRecives - .filter((x) => x.profileId != null) - .map(async (x) => x.profileId); + let profiles = command && command.commandRecives.length > 0 + ? command.commandRecives + .filter((x) => x.profileId != null) + .map((x) => x.profileId) + : []; await new CallAPI() .PostData(request, "/placement/noti/profiles", {