cannot delete carrier because of undefined lcrs list (#563)

This commit is contained in:
Hoan Luu Huu
2025-09-01 08:12:31 -04:00
committed by GitHub
parent f1f8a7d808
commit f7f4a2e7b1
@@ -4,7 +4,7 @@ import { P } from "@jambonz/ui-kit";
import { Modal, ModalClose } from "src/components"; import { Modal, ModalClose } from "src/components";
import { getFetch, getLcrRoutes, getLcrs } from "src/api"; import { getFetch, getLcrRoutes, getLcrs } from "src/api";
import { API_PHONE_NUMBERS } from "src/api/constants"; import { API_PHONE_NUMBERS } from "src/api/constants";
import { formatPhoneNumber, hasLength } from "src/utils"; import { formatPhoneNumber, hasLength, hasValue } from "src/utils";
import type { Carrier, Lcr, PhoneNumber } from "src/api/types"; import type { Carrier, Lcr, PhoneNumber } from "src/api/types";
@@ -63,7 +63,8 @@ export const DeleteCarrier = ({
), ),
); );
setLcrs(fetchedLcrs); // Only set LCRs if they are not empty
setLcrs(fetchedLcrs.filter((p) => hasValue(p)));
} }
}); });