Last active
November 8, 2019 22:06
-
-
Save cogell/9ba7c153d9b49b92fe455897958629e1 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
// /home | |
// /allow-location | |
// on yes -> start /results | |
// on no -> /invite to enter location | |
// /invite to enter location | |
// /loading | |
// /results | |
// /no-selection | |
// /valid-selection | |
// /empty | |
// /error | |
const fetchMachine = Machine({ | |
id: 'choose-home-patch', | |
initial: 'allowLocation', | |
states: { | |
allowLocation: { | |
on: { | |
ALLOW_LOCATION: 'loading', | |
NO_LOCATION: 'enterLocation', | |
} | |
}, | |
enterLocation: { | |
on: { | |
SUBMIT: 'loading', | |
} | |
}, | |
loading: { | |
on: { | |
ERROR: 'error', | |
NO_RESULTS: 'noResults', | |
RESULTS: 'results', | |
SUBMIT: 'loading', | |
} | |
}, | |
results: { | |
initial: 'noSelection', | |
states: { | |
noSelection: { | |
on: { | |
SELECT: 'selection', | |
} | |
}, | |
selection: { | |
on: { | |
UN_SELECT: 'noSelection', | |
} | |
}} | |
}, | |
noResults: { | |
on: { | |
SUBMIT: 'loading', | |
} | |
}, | |
error: { | |
on: { | |
SUBMIT: 'loading' | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment