actions.ts 729 B

12345678910111213141516171819202122232425262728
  1. import { AppNotification } from 'app/types';
  2. export enum ActionTypes {
  3. AddAppNotification = 'ADD_APP_NOTIFICATION',
  4. ClearAppNotification = 'CLEAR_APP_NOTIFICATION',
  5. }
  6. interface AddAppNotificationAction {
  7. type: ActionTypes.AddAppNotification;
  8. payload: AppNotification;
  9. }
  10. interface ClearAppNotificationAction {
  11. type: ActionTypes.ClearAppNotification;
  12. payload: AppNotification;
  13. }
  14. export type Action = AddAppNotificationAction | ClearAppNotificationAction;
  15. export const clearAppNotification = (alert: AppNotification) => ({
  16. type: ActionTypes.ClearAppNotification,
  17. payload: alert,
  18. });
  19. export const addAppNotification = (alert: AppNotification) => ({
  20. type: ActionTypes.AddAppNotification,
  21. payload: alert,
  22. });