I'm struggling with the code snippet below:
login = (email: string, senha: string): { nome: string, genero: string, foto: string;} => {
this.fireAuth.signInWithEmailAndPassword(email, senha).then(res => {
firebase.database().ref('Usuarios/' + res.uid).once('value', snapshot => {
return {
nome: snapshot.val().nome,
genero: snapshot.val().genero,
foto: snapshot.val().avatar
};
});
});
}
After logging in to Firebase and fetching my information, I expect it to return an object. However, I am encountering an error stating that I need to return something if the function type is not 'void' or 'any'. Despite returning an object as required.
Any advice on how to resolve this issue?