From 4a563d7885e00edbcbdd87dc8a70e6b4e578f15b Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 8 Aug 2024 10:22:51 +0700 Subject: [PATCH] fix: condition always true --- src/controllers/branch-controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/branch-controller.ts b/src/controllers/branch-controller.ts index c5384e3..aa808dc 100644 --- a/src/controllers/branch-controller.ts +++ b/src/controllers/branch-controller.ts @@ -297,7 +297,7 @@ export class BranchController extends Controller { const { provinceId, districtId, subDistrictId, headOfficeId, bank, contact, code, ...rest } = body; - if (head && head.code.slice(0, -6) !== code) { + if (headOfficeId && head && head.code.slice(0, -6) !== code) { throw new HttpError( HttpStatus.BAD_REQUEST, "Headoffice code not match with branch code",