Skip to content

Instantly share code, notes, and snippets.

@cellog
Last active April 11, 2020 01:12
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 cellog/552594ac3daac582fa659a4c268cd151 to your computer and use it in GitHub Desktop.
Save cellog/552594ac3daac582fa659a4c268cd151 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 tagsMachine = Machine({
id: 'type and tags filter',
initial: 'idle',
context: {
datasetId: "",
projectId: "",
type: "material-runs",
tags: "",
},
states: {
idle: {
on: {
SEARCH: {
target: "",
actions: [assign((_, { projectId, datasetId, type, tags }) => ({
datasetId, projectId, type, tags,
})),
"sendSearch"]
}
}
},
},
}, {
actions: {
sendSearch: send(({ tags, type, projectId, datasetId }) => ({
type: "SEARCH",
url: `/projects/${projectId}/${type}/filter-by-name?dataset_id=${datasetId}${tags ? `&tags=${tags}` : ""}`,
body: undefined,
}), {
to: "data object paging"
})
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment