I’m trying to use Graph.cool to login a user (by g...
# prisma-whats-new
j
I’m trying to use Graph.cool to login a user (by getting their token). I have this working, but when I run the
_signInUser
function I’m not seeing all of my commands execute. Here is what my
_signInUser
looks like
Copy code
_signInUser = async () => {
      try {
        const authenticationResult = await this.props.signInUserMutation({
          variables: { email: this.state.email, password: this.state.password }
        });
        AsyncStorage.setItem('token', authenticationResult.data.signinUser.token);
        this.props.navigation.navigate('Home');
        //await AsyncStorage.setItem('token', authenticationResult.data.signinUser.token);
      }
      catch (error) {
        console.log(error);
      }
    };
n
@joshjoe hmm did you manage to debug this? Looks like either a problem with promises/async or with the navigation lib you're using
j
No, I’m still not sure what might be happening. I’ll post back here if I do. Thanks
n
Alright - first of all do you know what
AsyncStorage.setItem
does? is it a promise?
n
So shouldn't you await it then? (as the commented-out code)
j
Yes, but wouldn’t it just move to the next line if I didn’t? And if it moved to the next line then I’d see the redirect.
Also, I tried that and I get the same strange behavior
I’m also trying to find where I can see the whole app state since I can’t log to the console from an async method it looks like I need to set a message in the state instead