Last active
August 12, 2019 16:08
-
-
Save duytq94/b446a5fc0e4d2dc613e4c7bdd8005cc4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| componentDidMount() { | |
| this.checkLogin() | |
| } | |
| checkLogin = () => { | |
| if (!localStorage.getItem(AppString.ID)) { | |
| this.setState({ | |
| isLoading: false | |
| }, () => { | |
| this.props.history.push('/') | |
| }) | |
| } else { | |
| this.getListUser() | |
| } | |
| } | |
| getListUser = async () => { | |
| const result = await myFirestore.collection(AppString.NODE_USERS).get() | |
| if (result.docs.length > 0) { | |
| this.listUser = [...result.docs] | |
| this.setState({ | |
| isLoading: false | |
| }) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment