appNotification.ts 747 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: number;
  13. }
  14. export type Action = AddAppNotificationAction | ClearAppNotificationAction;
  15. export const clearAppNotification = (appNotificationId: number) => ({
  16. type: ActionTypes.ClearAppNotification,
  17. payload: appNotificationId,
  18. });
  19. export const notifyApp = (appNotification: AppNotification) => ({
  20. type: ActionTypes.AddAppNotification,
  21. payload: appNotification,
  22. });