인증을 수행하는 반응이있는 기본 앱이 있습니다.Promise return undefined AsyncStorage
토큰이 만료되지 않고 사용 가능한지 확인하는 다음 코드가 있습니다.
export const isLogged =() => {
AsyncStorage.getItem('@token')
.then(token => {
if (typeof token !== 'undefined') {
if (tokenExpired(token)) {
return false
}
return true
}
return false
})
.catch(error => {
return false
})
}
하지만 내 코드에서
내가 할 경우 :let isUserLogged = isLogged()
console.log(isUserLogged) // -> returns undefined, but should return true because the token is there and its not expired.
사람이 어떤 생각이 왜 이런 식으로, 내가 뭔가 잘못하고있어 그했다합니까
?
다른 '다음'단계를 연결하고 거기에서 수표를해야합니다. – Redu