1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

How to return Observable<T> from Promise?

Discussão em 'Angular' iniciado por Amokachi, Setembro 28, 2024 às 16:12.

  1. Amokachi

    Amokachi Guest

    I am trying to return an authResult from the following method but it looks like all execution paths do not return a value.

    Here's my method:

    public loginWithFacebook(): Observable<AuthResult> {
    this.fbService.login().then((authResponse: any) => {
    const accessToken = authResponse.accessToken;
    return this.model.loginWithFacebook(accessToken).pipe(tap(res => this.setSession(res)), shareReplay());

    });
    }


    here's the error message:

    A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.

    How can I rewrite this to return Observable?

    Thanks for any attention.

    Continue reading...

Compartilhe esta Página