簡體   English   中英

僅在登錄時重定向用戶,而不是在 firebase javascript 中注冊

[英]only redirect a user on login not in registration in firebase javascript

firebase.auth().onAuthStateChanged(user => {
  if(user) {
    window.location = 'home.html';
  }
});

我正在嘗試創建一個登錄和注冊頁面,我已經完成了所有操作,但問題是我只想在用戶單擊登錄按鈕時重定向用戶,而不是在注冊時重定向,即使在注冊時,上面的代碼也無法幫助它重定向。 您可以提供給我的任何信息都會對此事有很大幫助,謝謝

那這個呢:

document.getElementById("login-button").addEventListener("click", function(){
  window.location = 'home.html';
});

這只是一個簡單的 JS 代碼,用於在單擊帶有id="login-button"的元素時將您轉到其他頁面。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM