bugfix rahdar code and car code

This commit is contained in:
2025-01-05 07:25:53 +00:00
committed by AmirHossein Mahmoodi
parent fa4c3e1459
commit c28824a58e
2 changed files with 4 additions and 3 deletions

View File

@@ -21,8 +21,7 @@ const CarCode = ({ carCode, setCarCode, inputValueDefault = "", error, multiple
requestOptions: { signal: controller.signal },
})
.then((response) => {
const combinedArray = [...carCode, ...response.data.data];
const combinedArray = carCode ? [...carCode, ...response.data.data] : [...response.data.data];
const uniqueArray = Array.from(new Map(combinedArray.map((item) => [item.id, item])).values());
setOptions(uniqueArray || []);
})

View File

@@ -22,7 +22,9 @@ const RahdarCode = ({ rahdarsCode, setRahdarsCode, error, multiple = true }) =>
requestOptions: { signal: controller.signal },
})
.then((response) => {
const combinedArray = [...rahdarsCode, ...response.data.data];
const combinedArray = rahdarsCode
? [...rahdarsCode, ...response.data.data]
: [...response.data.data];
const uniqueArray = Array.from(new Map(combinedArray.map((item) => [item.id, item])).values());
setOptions(uniqueArray || []);
})