Conversation
|
Preview URL for this branch is https://firebase.dpmhbfuiok7f8.amplifyapp.com. Please wait for sometime for the build to finish. |
maaverik
left a comment
There was a problem hiding this comment.
I guess this is still a work in progress item, but we could merge it if it doesn't break anything.
| import { useLinkDevice } from 'store/asyncActions'; | ||
|
|
||
| // Public key generated from firebase console | ||
| const vapidKey = |
There was a problem hiding this comment.
Just to clarify, it's okay to expose this key, right?
| errorText: '', | ||
| infoText: '', | ||
| notificationPermission: null, // This state value is initialised by the notification service. | ||
| // This value is initilised at start by services/notification/system.js |
There was a problem hiding this comment.
Nit: typo for initialised
| */ | ||
| export const linkDevice = (deviceId) => ({ | ||
| method: 'put', | ||
| url: `/owner/link?deviceId=${deviceId}`, |
There was a problem hiding this comment.
I'm thinking this resource should be named something else. I feel that owner doesn't fit its purpose. Do you think /notifications/subscribe would fit?
There was a problem hiding this comment.
Another approach I can think of is simply a /notifications endpoint with body
{
subscribe: <BOOL>,
deviceId: <ID>
}
for PUT and PATCH.
|
|
||
| const registerForNotifications = () => { | ||
| getToken(messaging, { vapidKey }) | ||
| .then((deviceId) => { |
There was a problem hiding this comment.
So, is deviceId generated internally by firebase? Is it unique for every device?
Uh oh!
There was an error while loading. Please reload this page.