[英]Angular Firebase not able to invoke Reset Password
我的代碼拋出錯誤Uncaught TypeError: _baseUrl.resetPassword is not a function
在我嘗試調用此函數時不是函數。
以下是我配置firebase對象的方法
var firebaseConfig = {
apiKey: "my api key",
authDomain: "my-domain.firebaseapp.com",
databaseURL: "https://collection-name.firebaseio.com",
projectId: "my-project-id-1111",
storageBucket: "my-storage-bucket.appspot.com",
messagingSenderId: "XXXXXXXXXX",
appId: "1:XXXXXXXXX:web:XXXXXXXXXX"
};
// Initialize Firebase
var _firebase = firebase.initializeApp(firebaseConfig);
var _baseUrl = _firebase.database().ref("web/data");
var _baseAuth = _firebase.auth();
function resetPassword(userEmail) {
_baseUrl.resetPassword({
email: userEmail
}, function(error) {
console.log(error);
if (error === null) {
return false;
} else {
return error;
}
});
}
當我調用resetPassowrd函數時,它會拋出一個錯誤。 Uncaught TypeError: _baseUrl.resetPassword is not a function
我已通過調試檢查我在我的函數中收到“_baseUrl”,但它沒有方法resetPassword
請提前幫助和謝謝
var firebaseConfig = {
apiKey: "my api key",
authDomain: "my-domain.firebaseapp.com",
databaseURL: "https://collection-name.firebaseio.com",
projectId: "my-project-id-1111",
storageBucket: "my-storage-bucket.appspot.com",
messagingSenderId: "XXXXXXXXXX",
appId: "1:XXXXXXXXX:web:XXXXXXXXXX"
};
// Initialize Firebase
var _firebase = firebase.initializeApp(firebaseConfig);
var _baseUrl = _firebase.database().ref("web/data");
var _baseAuth = _firebase.auth();`enter code here`
function resetPassword(userEmail) {
_baseAuth.sendPasswordResetEmail(
userEmail, actionCodeSettings=null)
.then(function() {
console.log('email sent');
})
.catch(function(error) {
console.log('error occurred');
});
}
我已經使用此功能重置密碼,它工作正常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.