I have this table I called users in asyncStorage that can be use to saved more than one users details(i.e. More than one user can login into the app using just one phone).
I have
const users = {
email: this.state.email,
password: this.state.password,
sex: this.state.sex
};
Then save it using JSON.stringify()
Now, how do I retrieve the correct user info?
AM thinking along this line but don't know how to implement it due to using
AsyncStorage
SELECT email, password from users where email===this.state.email and password === this.state.password
I also think of something along this line, but sure am doing the wrong thing
getStudent = async () => {
//function to get the value from AsyncStorage
let users= await AsyncStorage.getItem('students');
let allUsers= JSON.parse(users);
// Check if entered username and password equals any username and password from the DB
allUsers.filter(function (credentials) {
credentials.email.includes(this.state.email);// Then, I hit the wall here
})
this.props.navigation.navigate('ViewProfile');
};
How can I go about it?