Skip to content

Instantly share code, notes, and snippets.

@0xjcf
Last active September 3, 2020 18:39
Show Gist options
  • Save 0xjcf/f32f2b3d2723be1280a7ace417330b34 to your computer and use it in GitHub Desktop.
Save 0xjcf/f32f2b3d2723be1280a7ace417330b34 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const modalMachine = Machine({
id: 'modal-machine',
initial: 'logIn',
states: {
logIn: {
initial: 'idle',
states: {
idle: {}
},
on: {
CHANGE: '.idle',
SIGN_UP: 'signUpModal',
LOG_IN: 'verifyLogIn'
}
},
verifyLogIn: {
on: {
RESOLVE: 'mainPage',
REJECT: 'error'
}
},
signUpModal: {
initial: 'idle',
states: {
idle: {}
},
on: {
CHANGE: '.idle',
MODAL_SIGN_UP: 'mainPage'
}
},
logInModal: {
on: {
CLOSE: 'logIn'
}
},
mainPage: {
on: {
LOG_OUT: 'logIn'
}
},
error: {
on: {
CLOSE: 'logIn'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment