update value on input msisdn withdrawal emoney

This commit is contained in:
Wikzyy
2025-05-30 13:36:20 +07:00
parent 851af85672
commit 8febb73db9

View File

@ -72,7 +72,6 @@ const WithdrawInput = () => {
try {
const response = await GetData(`${API_URL_CUSTOMER}/customer/list`, query);
console.log(response?.data);
setCustomerMsisdn(
response?.data.list.map((item: any) => ({
value: item.id,
@ -145,10 +144,10 @@ const WithdrawInput = () => {
return () => clearTimeout(timer);
};
const handleMsisdnSelect = (msisdn: string) => {
setForm({ ...form, id_customer: msisdn });
const handleMsisdnSelect = (item: { value: string; label: string }) => {
setForm({ ...form, id_customer: item.value });
setDropdownOpen(false);
setSearchTerm(msisdn);
setSearchTerm(item.label);
};
useEffect(() => {
@ -201,7 +200,7 @@ const WithdrawInput = () => {
<div
key={index}
className="px-4 py-2 hover:bg-gray-100 cursor-pointer"
onClick={() => handleMsisdnSelect(item.value)}
onClick={() => handleMsisdnSelect(item)}
>
{item.label}
</div>