open-consul/ui-v2/app/components/data-loader/chart.xstate.js
2020-07-09 10:08:47 +01:00

47 lines
647 B
JavaScript

export default {
id: 'data-loader',
initial: 'load',
on: {
ERROR: {
target: 'disconnected',
},
LOAD: [
{
target: 'idle',
cond: 'loaded',
},
{
target: 'loading',
},
],
},
states: {
load: {},
loading: {
on: {
SUCCESS: {
target: 'idle',
},
ERROR: {
target: 'error',
},
},
},
idle: {},
error: {
on: {
RETRY: {
target: 'load',
},
},
},
disconnected: {
on: {
RETRY: {
target: 'load',
},
},
},
},
};