Created
June 4, 2020 10:13
-
-
Save RafalFilipek/9ff0ec499c427519d883bf629b0597e4 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* wybierz = actions.choose([{ | |
cond: 'isPhone', | |
target: 'phone' | |
},{ | |
cond: 'isPesel', | |
target: 'pesel' | |
}, { | |
cond: 'isEmail', | |
target: 'email' | |
}]) | |
} | |
} | |
}, */ | |
const m = Machine({ | |
initial: 'common', | |
states: { | |
common: { | |
on: { | |
SET_DATA: { | |
actions: 'wybierz' | |
} | |
}, | |
initial: 'unknown', | |
states: { | |
unknown: {}, | |
phone: { | |
invoke: { | |
src: 'phoneCostam', | |
onDone: { | |
target: '#phone' | |
} | |
} | |
}, | |
pesel: { | |
invoke: { | |
src: 'peselCostam', | |
onDone: { | |
target: '#pesel' | |
} | |
} | |
}, | |
email: { | |
invoke: { | |
src: 'emailCostam', | |
onDone: { | |
target: '#email' | |
} | |
} | |
}, | |
}, | |
}, | |
phone: {id: 'phone', on: {OK: { target: 'success' }}}, | |
email: {id: 'email', on: {OK: { target: 'success' }}}, | |
pesel: {id: 'pesel', on: {OK: { target: 'success' }}}, | |
success: {} | |
}}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment