IO-1551 Polling mode for unsupported browsers.

This commit is contained in:
Patrick Fic
2021-12-08 17:05:44 -08:00
parent 76ea8ca2ed
commit 58848481c9
9 changed files with 74 additions and 27 deletions

View File

@@ -38,8 +38,14 @@ export const updateCurrentPassword = async (password) => {
return updatePassword(currentUser, password);
};
let messaging;
try {
messaging = getMessaging();
} catch (error) {
console.log(error);
}
export const messaging = getMessaging();
export { messaging };
export const requestForToken = () => {
return getToken(messaging, {
@@ -48,6 +54,7 @@ export const requestForToken = () => {
.then((currentToken) => {
if (currentToken) {
console.log("current token for client: ", currentToken);
window.sessionStorage.setItem("fcmtoken", currentToken);
// Perform any other necessary action with the token
} else {
// Show permission request UI