Last active
October 22, 2019 15:18
-
-
Save tychota/402b053bfa750a53bf655f38324d29b3 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
const fetchMachine = Machine({ | |
id: 'user', | |
initial: 'NotCreated', | |
context: {}, | |
states: { | |
NotCreated: { | |
on: { | |
CREATE_USER: 'NotAgreedUser', | |
MIGRATE_USER: 'MigratedUser' | |
} | |
}, | |
NotAgreedUser: { | |
on: { | |
SET_BIRTHDATE: { | |
target: "NotAgreedUser", | |
action: "SetBirthdate" | |
}, | |
AGREE_ETHICS: { | |
target: "AgreedUser", | |
} | |
} | |
}, | |
AgreedUser: { | |
on: { | |
SET_MAIN_PHOTO: "CompleteUser" | |
} | |
}, | |
MigratedUser: { | |
on: { | |
FINISH_LEGACY_ONBOARDING: "CompleteUser" | |
} | |
}, | |
CompleteUser: {} | |
}, | |
actions: { | |
SetBirthdate: assign({ | |
birthdate: (context, event) => { | |
context.birthdate = event.value | |
} | |
}) | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment