我想知道是否有办法检测用户是否已使用firebase登录并重定向到某个页面。
我正在使用这个firebase方法
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
location.href = 'feed.html';
} else {
location.href = 'login.html';
}
});
但是,如果我将此代码放在index.js函数(deviceready)中,它会不断刷新页面。
在swift中,我会把这个控件放在didFinishLaunchingWithOptions中,但我在Cordova中找不到类似的东西。
你能救我吗?