AsyncStorage React Native Login

0

I'm trying to keep the user logged in to my app, so I made the following the user log in.

AsyncStorage.setItem('@MyStorage:Token', res.data.accessToken)
AsyncStorage.setItem('@MyStorage:Flag', true)

And I tried to do so to validate every time I enter the login page

componentWillMount(){
        this._validate()
    }

    _validate = async () => {
        try{
            const value = await AsyncStorage.getItem('@MyStorage:Flag')
            console.log(value)
        }catch(e){
            console.log(e)
        }
    }

But none of the console.log() is returned, what would be the best way to do this?

    
asked by anonymous 10.07.2018 / 17:02

0 answers