Added notification generation on SMS. Added FCM Token saving on login.

This commit is contained in:
Patrick Fic
2020-05-01 12:32:40 -07:00
parent 92aeb419a9
commit 636e979fd0
21 changed files with 3810 additions and 45 deletions

View File

@@ -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;