From d48cfd3fedcaf6ed287878ab64a3c258f3caa1e5 Mon Sep 17 00:00:00 2001 From: Bheem Date: Fri, 12 Jun 2020 14:25:12 +0530 Subject: [PATCH] firebase app initialize issue fix --- .../Auth/components/LoginWithGoogleButton.js | 6 ++++-- src/containers/DesktopSignIn/DesktopSignIn.js | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/containers/Auth/components/LoginWithGoogleButton.js b/src/containers/Auth/components/LoginWithGoogleButton.js index 95f7fa309..db71432c1 100644 --- a/src/containers/Auth/components/LoginWithGoogleButton.js +++ b/src/containers/Auth/components/LoginWithGoogleButton.js @@ -35,8 +35,10 @@ class LoginWithGoogleButton extends Component { componentDidMount(){ if(isElectron && isElectron()){ // Initialize Firebase - const firebaseConfig = OAuthConfig.firebaseConfig; - firebase.initializeApp(firebaseConfig); + if(!firebase.apps.length){ + const firebaseConfig = OAuthConfig.firebaseConfig; + firebase.initializeApp(firebaseConfig); + } } } doLogin = async () => { diff --git a/src/containers/DesktopSignIn/DesktopSignIn.js b/src/containers/DesktopSignIn/DesktopSignIn.js index 8e7bc0124..03178e54e 100644 --- a/src/containers/DesktopSignIn/DesktopSignIn.js +++ b/src/containers/DesktopSignIn/DesktopSignIn.js @@ -46,9 +46,13 @@ class DesktopSignIn extends Component { this.displaySocialAuthMsg(true); // Initialize Firebase - const firebaseConfig = OAuthConfig.firebaseConfig; - firebase.initializeApp(firebaseConfig); - + console.log('[DT] firebaseApps length',firebase.apps.length); + if(!firebase.apps.length){ + const firebaseConfig = OAuthConfig.firebaseConfig; + firebase.initializeApp(firebaseConfig); + } + console.log('[DT] firebaseApps length',firebase.apps.length); + //get firebase ref const oneTimeCodeRef = firebase.database().ref(`ot-auth-codes/${this.getOneTimeCode()}`) -- GitLab