What is the equivalent to services in xstate 5?
I have tried fromPromise, that works but I do not always want to return a promise.
I intend to define an async function that does a firebase read and then an axios call (so a chain of promises), and then onDone or onErrors when that whole function finishes. Is there a way to do this in a single code block or do I have to compose individual state transitions something like that?
pseudocode ish example of what I would like to do in xstate 5:
const myMachine = createMachine({
//some machine...
},
{
services:{
getUser: async (event, context)=>{
const user = await context.db.collection("users").get();
//do some logic about that user
const userData = await context.db.somethingElseBasedOnThatLogic();
const data = //manipulate userData;
const response = axios.post(url,data);
}
}
}
)
Thank you