Added notification generation on SMS. Added FCM Token saving on login.
This commit is contained in:
@@ -9,13 +9,12 @@ import apolloLogger from "apollo-link-logger";
|
||||
import { RetryLink } from "apollo-link-retry";
|
||||
import { WebSocketLink } from "apollo-link-ws";
|
||||
import { getMainDefinition } from "apollo-utilities";
|
||||
import LogRocket from "logrocket";
|
||||
import React, { Component } from "react";
|
||||
import GlobalLoadingBar from "../components/global-loading-bar/global-loading-bar.component";
|
||||
import { auth, messaging } from "../firebase/firebase.utils";
|
||||
import { auth } from "../firebase/firebase.utils";
|
||||
import errorLink from "../graphql/apollo-error-handling";
|
||||
import App from "./App";
|
||||
import LogRocket from "logrocket";
|
||||
import { notification } from "antd";
|
||||
|
||||
if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp");
|
||||
|
||||
@@ -117,29 +116,6 @@ export default class AppContainer extends Component {
|
||||
this.state = { client };
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
messaging
|
||||
.requestPermission()
|
||||
.then(async function () {
|
||||
const token = await messaging.getToken();
|
||||
console.log("messaging -> token", token);
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.log("Unable to get permission to notify.", err);
|
||||
});
|
||||
navigator.serviceWorker.addEventListener("message", (message) => {
|
||||
console.log("Comp Did Mount", message);
|
||||
notification["info"]({ message: JSON.stringify(message.data) });
|
||||
navigator.serviceWorker
|
||||
.getRegistration()
|
||||
.then((registration) =>
|
||||
registration.showNotification(
|
||||
"Comp Did" + JSON.stringify(message.data)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { client } = this.state;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user