File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/camera/src/components/UploadCenter/hooks Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,12 @@ export default function useComplianceIds({
28
28
const iqa = result . data . compliances . image_quality_assessment ;
29
29
30
30
// Filter unwanted reasons
31
- carCov . reasons = filterUnwantedComplianceReasons ( carCov . reasons ) ;
32
- iqa . reasons = filterUnwantedComplianceReasons ( iqa . reasons ) ;
31
+ if ( carCov ) {
32
+ carCov . reasons = filterUnwantedComplianceReasons ( carCov . reasons ) ;
33
+ }
34
+ if ( iqa ) {
35
+ iqa . reasons = filterUnwantedComplianceReasons ( iqa . reasons ) ;
36
+ }
33
37
34
38
// `handleChangeReasons` returns the full result object with the given compliances
35
39
const handleChangeReasons = ( compliances ) => ( {
@@ -61,7 +65,7 @@ export default function useComplianceIds({
61
65
if ( ! carCov ?. reasons ) { return { ...item , requestCount, result } ; }
62
66
63
67
// remove the UNKNOWN_SIGHT from the carCov reasons array
64
- const newCarCovReasons = carCov . reasons ?. filter ( ( reason ) => reason !== UNKNOWN_SIGHT_REASON ) ;
68
+ const newCarCovReasons = carCov ? .reasons ?. filter ( ( reason ) => reason !== UNKNOWN_SIGHT_REASON ) ;
65
69
return handleChangeReasons ( {
66
70
coverage_360 : { reasons : newCarCovReasons , is_compliant : ! newCarCovReasons . length } ,
67
71
} ) ;
You can’t perform that action at this time.
0 commit comments