File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -77,14 +77,17 @@ export class DefaultApiConfiguration implements ApiConfiguration {
77
77
return stateMachine ;
78
78
}
79
79
80
+
80
81
private findStateByCode ( stateMachine : StateMachine , stateCode : number ) : State {
81
- const statesArray = stateMachine . states [ 0 ] ?. State ;
82
+ const stateContainer = stateMachine . states [ 0 ] ;
83
+ const statesArray = Array . isArray ( stateContainer ?. State )
84
+ ? stateContainer . State
85
+ : stateContainer ?. State
86
+ ? [ stateContainer . State ]
87
+ : [ ] ;
82
88
83
- if ( ! statesArray ) {
84
- throw new Error ( `State '${ stateCode } ' not found` ) ;
85
- }
89
+ const result = statesArray . find ( state => Number ( state . id ) === stateCode ) ;
86
90
87
- const result = statesArray . find ( state => Number ( state . attributes . id ) === stateCode ) ;
88
91
if ( ! result ) {
89
92
throw new Error ( `State '${ stateCode } ' not found` ) ;
90
93
}
You can’t perform that action at this time.
0 commit comments