fix: EDeclicLib null test

This commit is contained in:
2019-02-12 14:46:05 +01:00
parent 1b4a5c570b
commit 4996307525
2 changed files with 7 additions and 3 deletions
+5 -2
View File
@@ -27,8 +27,10 @@ class Messager extends Component {
async componentDidMount() {
EdeclicLib = (await import('./firebase-client.js')).default
if (!EdeclicLib.messaging)
if (!EdeclicLib||!EdeclicLib.messaging)
return
console.log('componentDidMount')
this.setState({ tokenStopListener: EdeclicLib.messaging.onTokenRefresh(this.RefreshToken) })
this.setState({ messageStopListener: EdeclicLib.messaging.onMessage(this.MessageReceiver) })
@@ -36,8 +38,9 @@ class Messager extends Component {
componentWillUnmount() {
if (process.browser) {
if (!EdeclicLib.messaging)
if (!EdeclicLib||!EdeclicLib.messaging)
return
console.log('componentWillUnmount')
if (!!this.state.tokenStopListener)
this.state.tokenStopListener();
if (!!this.state.messageStopListener)
+2 -1
View File
@@ -32,12 +32,13 @@ class ListeSAV extends React.Component {
async componentDidMount() {
if (!!localStorage.AG2LToken) {
const res = await fetch(publicRuntimeConfig.apiUrl.Qtbl_Itv_Sav + '?range=0-1',
{
method: "GET",
headers: {
"Accept": "application/json",
'Authorization': 'Bearer ' + localStorage.AG2LToken
'Authorization': 'Bearer ' + localStorage.AG2LToken,
}
})