{"size": 516, "ext": "js", "max_stars_repo_path": "web/src/hooks/notification.js", "max_stars_repo_name": "keeperSpot/shop", "max_stars_repo_stars_event_min_datetime": "2021-09-28T06:07:34.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-28T06:07:34.000Z", "max_issues_repo_path": "web/src/hooks/notification.js", "max_issues_repo_name": "keeperSpot/shop", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "web/src/hooks/notification.js", "max_forks_repo_name": "keeperSpot/shop", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.8, "max_line_length": 63, "alphanum_fraction": 0.6279069767}
import { useEffect } from 'react';
import { deviceInfo, fullDeviceInfo } from 'helpers/device';
import { register } from 'common/helpers/device';


export const useNotification = () => {
  useEffect(() => {
    const device = deviceInfo();
    window.device = device;

    window.OneSignal.push(async () => {
      const userId = await window.OneSignal.getUserId();
      window.device = { ...device, id: userId };
      await register({ userId, fullDeviceInfo, pushToken: '' })
    });
  }, []);

  return null;
};
