Skip to content

Instantly share code, notes, and snippets.

@broerjuang
Last active August 25, 2019 19:16
Show Gist options
  • Save broerjuang/60cc88f9aed525441d63353a13b57988 to your computer and use it in GitHub Desktop.
Save broerjuang/60cc88f9aed525441d63353a13b57988 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
let auth = {
initial: 'login_screen',
states: {
login_screen: {
on: {
NAVIGATE_REGISTER_SCREEN: 'register_screen'
}
},
register_screen: {
on: {
NAVIGATE_LOGIN_SCREEN: 'login_screen'
}
},
},
on: {
LOGIN_SUCCESS: 'app',
LOGIN_FAILED: 'auth',
REGISTER_SUCCESS: 'app'
}
}
let app = {
initial: 'home_screen',
states: {
home_screen: {
on: {
NAVIGATE_PROFILE: 'profile_screen'
}
},
profile_screen:{
on:{
NAVIGATE_HOME_SCREEN:'home_screen'
}
}
},
on: {
LOGGED_OUT: 'auth',
}
}
let splash = {
initial: 'initializing',
states: {
initializing: {
type: 'final'
}
},
on: {
CHECK_SUCCESS: 'app',
CHECK_FAIL: 'auth'
}
}
let course_finder = Machine({
id: 'course_finder_app',
initial: 'splash',
states: {
splash,
app,
auth
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment