Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_syncUserWithStateAsync = async () => {
/*
const user = await GoogleSignIn.signInSilentlyAsync();
this.setState({ user });
*/
if (await GoogleSignIn.signInSilentlyAsync()) {
const photoURL = await GoogleSignIn.getPhotoAsync(256);
const user = await GoogleSignIn.getCurrentUserAsync();
if (user) {
this.setState({
user: {
...user.toJSON() as { displayName: string, email: string },
photoURL: photoURL || user.photoURL!,
},
});
}
} else {
this.setState({ user: undefined });
}
}