2022-11-22 22:19:10 +00:00
|
|
|
const STATUS = {
|
|
|
|
loading: Symbol('loading'),
|
|
|
|
loaded: Symbol('loaded'),
|
|
|
|
failed: Symbol('failed'),
|
|
|
|
noData: Symbol('noData'),
|
|
|
|
disabled: Symbol('disabled'),
|
2022-12-12 19:53:33 +00:00
|
|
|
retrying: Symbol('retyring'),
|
2022-11-22 22:19:10 +00:00
|
|
|
};
|
|
|
|
|
2022-12-14 17:20:25 +00:00
|
|
|
const calcStatusClass = (statusCode) => {
|
|
|
|
switch (statusCode) {
|
|
|
|
case STATUS.loading:
|
|
|
|
return 'loading';
|
|
|
|
case STATUS.loaded:
|
|
|
|
return 'press-here';
|
|
|
|
case STATUS.failed:
|
|
|
|
return 'failed';
|
|
|
|
case STATUS.noData:
|
|
|
|
return 'no-data';
|
|
|
|
case STATUS.disabled:
|
|
|
|
return 'disabled';
|
|
|
|
case STATUS.retrying:
|
|
|
|
return 'retrying';
|
|
|
|
default:
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const statusClasses = ['loading', 'press-here', 'failed', 'no-data', 'disabled', 'retrying'];
|
|
|
|
|
2022-11-22 22:19:10 +00:00
|
|
|
export default STATUS;
|
2022-12-14 17:20:25 +00:00
|
|
|
export {
|
|
|
|
calcStatusClass,
|
|
|
|
statusClasses,
|
|
|
|
};
|