loading.ts 317 B

1234567891011121314151617
  1. import { action, Action } from "easy-peasy";
  2. export interface Loading {
  3. loading: boolean;
  4. show: Action<Loading>;
  5. hide: Action<Loading>;
  6. }
  7. export const loading: Loading = {
  8. loading: false,
  9. show: action(state => {
  10. state.loading = true;
  11. }),
  12. hide: action(state => {
  13. state.loading = false;
  14. })
  15. };