Created
March 29, 2021 20:29
-
-
Save GABAnich/ca02eeb27ebcb1cfc426012fa9e62fa9 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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) | |
const fetchMachine = Machine({ | |
id: 'vacation', | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
REQUEST: 'waiting_for_manager_approve' | |
} | |
}, | |
waiting_for_manager_approve: { | |
on: { | |
MANAGER_APPROVE: 'waiting_for_team_approve.one_of_three', | |
MANAGER_REJECT: 'rejected' | |
} | |
}, | |
waiting_for_team_approve: { | |
states: { | |
one_of_three: { | |
on: { | |
TEAM_APPROVE: 'two_of_three', | |
TEAM_REJECT: '#vacation.rejected' | |
} | |
}, | |
two_of_three: { | |
on: { | |
TEAM_APPROVE: 'three_of_three', | |
TEAM_REJECT: '#vacation.rejected' | |
} | |
}, | |
three_of_three: { | |
on: { | |
TEAM_APPROVE: '#vacation.approved', | |
TEAM_REJECT: '#vacation.rejected' | |
} | |
} | |
} | |
}, | |
approved: { | |
type: 'final' | |
}, | |
rejected: { | |
type: 'final' | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment