v1.6.2/admin dashboard
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import React from 'react';
|
||||
import { Component } from 'react';
|
||||
import Login from './Login';
|
||||
import Dashboard from './Dashboard';
|
||||
import firebase from 'firebase/app';
|
||||
import 'firebase/auth';
|
||||
|
||||
export default class App extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
auth: false,
|
||||
};
|
||||
}
|
||||
componentDidMount() {
|
||||
firebase.auth().onAuthStateChanged((authUser) => {
|
||||
if (authUser && !authUser.isAnonymous) {
|
||||
this.setState({ auth: true });
|
||||
} else {
|
||||
this.setState({ auth: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
render() {
|
||||
const { auth } = this.state;
|
||||
return <div className="app-wrapper">{auth ? <Dashboard /> : <Login />}</div>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user