Why firstValueFrom doesn't work in provideAppInitializer

Discussão em 'Angular' iniciado por Андрій Степанов, Maio 6, 2025.

  1. I have a token stored in memory, in an injectable service. So when I reload the page or try to access the component via the Google search box, I lose it. storage service storage service in token service

    I was faced with the problem that I need a function that will check and update the token before I need it. The interceptor is not entirely suitable, because in my case there were some problems with combining it and resolvers. I came across App Initializer. It should return Observable | Promise | void. So I decided to wrap my Observable and make it a Promise using firstvaluefrom. An error occurred, I didn't understand why and still don't. Who knows? The method inside firstvaluefrom doesn't even go inside.

    enter image description here enter image description here

    There is a single network request.

    enter image description here

    Continue reading...

Compartilhe esta Página