fix: condition always true

This commit is contained in:
Methapon2001 2024-08-08 10:22:51 +07:00
parent 0ffa7e410a
commit 4a563d7885

View file

@ -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",