Http.request приводит к TypeError: "values ​​is null" - PullRequest
0 голосов
/ 11 июля 2019

Я пытаюсь выполнить сохраненные запросы из локального хранилища.

При выполнении http.request() возвращается следующая ошибка: Error when subscribing on http.request()

Код, отвечающий за отправку запросов:

public sync() {
    this.setSyncState(SyncState.Syncing)
    Array.from(this.stateManager.entries()).forEach(([key, value]) => {
      let newRequest: HttpRequest<any> = { ...value }

      this.http.request(
        newRequest.method,
        newRequest.urlWithParams,
        { 
          body: newRequest.body, 
          headers: newRequest.headers, 
          params: newRequest.params,
          reportProgress: newRequest.reportProgress, 
          responseType: newRequest.responseType,
          withCredentials: newRequest.withCredentials
        }
      ).subscribe(
        event => {
          if (event instanceof HttpResponse) {
            this.stateManager.delete(key)
            console.log("Request from cache succeeded")
          }
        },
        error => {
          console.log("Request from cache failed", error)
        }
      )
    })
    if (Array.from(this.stateManager.entries()).length < 0) {
      this.setSyncState(SyncState.Synced)
    } else {
      this.setSyncState(SyncState.SyncFailed)
    }
  }

stateManager.entries () возвращает сохраненные запросы в de localstorage в виде карты.

Может кто-нибудь указать мне в каком-то направлении, чтобы посмотреть? Я не могу найти причину ошибки.

...