Skip to content

Instantly share code, notes, and snippets.

@devstojko
Last active March 22, 2020 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devstojko/c0a6df530de66c2cf067a4a31a676bf5 to your computer and use it in GitHub Desktop.
Save devstojko/c0a6df530de66c2cf067a4a31a676bf5 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const trip = {
companyName: '',
accommodations: []
}
const fetchPrice = () => fetch(WITHOUT_FIRST_TRIP).then(response => response.json());
const basketMachine = Machine({
id: 'basketMachine',
initial: 'selectRoute',
context: {
allowedCompany: null,
routes: [trip],
hasSelectedRoutes: false,
},
states: {
selectRoute: {
on: {
SELECT_ROUTE: {
actions: () => {}
},
CHANGE_STATE: {
target: 'selectAccommodation'
}
}
},
selectAccommodation: {
on: {
SELECT_ACCOMMODATION: {
},
CHANGE_STATE: {
target: 'selectRoute'
}
}
}
}
},
{
guards: {
hasSelectedRoutes: () => false
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment