首页 > 解决方案 > 如何使用 Firebase Auth 强制退出用户?

问题描述

我正在尝试使用使用 firebase 构建的 Firebase Auth 退出应用程序。这实际上将用户注销,但它无法渲染新页面并给我:

TypeError: Cannot read property 'push' of undefined

这是我的代码:

 // sign out
    const signOut = (history ) => {
      doSignOut().then(() => {props.history.push(routes.SIGN_IN)})
    }
    // 
    firestore.collection('customers').doc(userID).collection('subscriptions')
      .where('status', '==', 'trialing' || "active").get()
      .then(activeSubscriptions => {
        // if this is true, the user has no active subscription.
        if (activeSubscriptions.empty === false) {
          console.log("line 31")
          {signOut(props.history)}
        }
      });

有任何想法吗?

标签: javascriptreactjsfirebasefirebase-authentication

解决方案


推荐阅读