Last active
September 14, 2020 04:45
-
-
Save kaze/623d75154a2e220396a645c08b39eabe 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
const login_activate_signal = 'login.activate'; | |
const login_deactivate_signal = 'login.deactivate'; | |
const register_activate_signal = 'register.activate'; | |
const register_deactivate_signal = 'register.deactivate'; | |
const send_activate_login = () => { | |
send({ type: login_activate_signal }) | |
}; | |
const send_deactivate_login = () => { | |
send({ type: login_deactivate_signal }) | |
}; | |
const send_activate_register= () => { | |
send({ type: register_activate_signal }) | |
}; | |
const send_deactivate_register = () => { | |
send({ type: register_deactivate_signal }) | |
}; | |
const auth_machine = Machine({ | |
id: 'auth', | |
initial: 'login', | |
context: {}, | |
states: { | |
login: { | |
on: { | |
register: { | |
target: 'register', | |
}, | |
}, | |
entry: [ 'send_activate_login', ], | |
exit: [ 'send_deactivate_login', ], | |
}, | |
register: { | |
entry: [ 'send_activate_register', ], | |
exit: [ 'send_deactivate_register', ], | |
on: { | |
login: { | |
target: 'login', | |
}, | |
}, | |
}, | |
}, | |
}, { | |
actions: { | |
send_activate_login, | |
send_deactivate_login, | |
send_activate_register, | |
send_deactivate_register, | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment