J
J
Jebati2021-12-30 09:31:28
Angular
Jebati, 2021-12-30 09:31:28

RxJS how to return request cache and make new request?

Hello.

I have a request in a service:

getOrderGSInfo(): Observable<OrderInfoGame[]> {
    return this.http
      .get<OrderInfoGame[]>(`${environment.api.url}billing/gs/order`)
  }

And the call in the component:
this.billingService.getTestGSInfo().subscribe(next, error)


I need to make it so that when subscribing at the beginning, data from the cache is returned without waiting for a response from the API (it is done anyway), and then new data comes from the API.
How to implement this?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question