Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

120
Visualizações
Async Yield call returning undefined in React

I have an async function for getting token from firebase. But when I fired this function returned undefined. When I consol.log my async function it's return token. After Yield call, returns undefined. I am a new student and I have no idea what is happening. So..If anyone can help me with this problem It's really helped me with my studies. Thank you.❤️

 React.useEffect(() => {
        dispatch(AddUserTokenListener())
    }, [])

async function getUserIDAsync() {
        const idTokenResult = await firebase.auth().currentUser.getIdTokenResult();
        // console.log('User JWT: ', idTokenResult); But this will return token
    }
    
    export function* getUserToken() {
        try {
            const userToken = yield call(getUserIDAsync);
           // console.log(userToken) this will return undefined .
            if (userToken) {
                console.log(userToken)
                yield put(AddUserTokenSuccess(userToken))
            }
        } catch (error) {
            console.log(error)
            yield put(AddUserTokenField(error))
        }
    }
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda