我想要的是,如果用户已经登录,则应用应跳过登录页面并显示主页面。 我尝试了以下代码,但它不起作用。如何克服这个问题?
var models = [
'123.svf',
'123.svf'
];
function _onGeometryLoaded( event ) {
if( urns.length <= 0 ) {
viewer.removeEventListener(
Autodesk.Viewing.GEOMETRY_LOADED_EVENT,
_onGeometryLoaded
);
return;
}
viewer.loadModel( urns[0], { globalOffset: event.model.getData().globalOffset } );
urns.splice( 0, 1 );
}
viewer.addEventListener(
Autodesk.Viewing.GEOMETRY_LOADED_EVENT,
_onGeometryLoaded
);
viewer.loadModel( urns[0] );
urns.splice( 0, 1 );
答案 0 :(得分:1)
看看这个提示,它应该可以解决你的问题
class App extends React.Component {
constructor() {
super();
this.state = {
loading: true,
authenticated: false,
};
}
componentWillMount() {
firebase.auth().onAuthStateChanged((user) => {
if (user) {
this.setState({ loading: false, authenticated: true });
} else {
this.setState({ loading: false, authenticated: false });
}
});
}
render() {
if (this.state.loading) return null; // Render loading/splash screen etc
if (!this.state.authenticated) {
return <Login />;
}
return <Home />;
}
}