armadiazrino

Untitled

Sep 30th, 2022
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. handleNotification = async (notification, type) => {
  2. const {
  3. setDeeplinkUrl,
  4. displayOpenAppNotification,
  5. validateNotificationHandler
  6. } = this;
  7. const {profile, reqSetPushNotificationData} = this.props;
  8.  
  9. const payloadNotification = notification.payload
  10. ? notification.payload
  11. : notification;
  12.  
  13. const notificationPayload = {...payloadNotification.data, type};
  14.  
  15. const deeplink = `${notificationPayload?.deepLink}&title=${notification?.title}&desc=${notification?.body}`;
  16.  
  17. if (type === NOTIF_APP_OPEN) {
  18. return displayOpenAppNotification({...notification, type});
  19. }
  20.  
  21. setDeeplinkUrl(deeplink);
  22.  
  23. await reqSetPushNotificationData({deepLink: deeplink, type});
  24.  
  25. if (profile.id !== 0) {
  26. return validateNotificationHandler();
  27. }
  28. };
  29.  
Advertisement
Add Comment
Please, Sign In to add comment