rxjs

How can I join two Firestore queries using rxfire and rxjs (OR query)

放肆的年华 提交于 2021-01-20 18:39:25
问题 The goal is simple: to join two firestore queries utilizing rxjs , rxfire , and the rnfirebase react native library. I've read multiple tutorials 1, 2 on joining queries, but they all fail with different errors. //Simple test for collectionData import { collectionData } from 'rxfire/firestore'; this.myQuery = this.props.docRef.collection(`messages`).where('read', 'array-contains', this.props.me.uid) collectionData(this.myQuery, 'id').subscribe(docs => console.log(docs)) //Fails with error:

How can I join two Firestore queries using rxfire and rxjs (OR query)

白昼怎懂夜的黑 提交于 2021-01-20 18:39:02
问题 The goal is simple: to join two firestore queries utilizing rxjs , rxfire , and the rnfirebase react native library. I've read multiple tutorials 1, 2 on joining queries, but they all fail with different errors. //Simple test for collectionData import { collectionData } from 'rxfire/firestore'; this.myQuery = this.props.docRef.collection(`messages`).where('read', 'array-contains', this.props.me.uid) collectionData(this.myQuery, 'id').subscribe(docs => console.log(docs)) //Fails with error:

How should I modify the response to an HTTP request and easily access it before return it out from Observable?

廉价感情. 提交于 2021-01-20 15:35:27
问题 I'm upgrading to Angular to version 5, I was using @angular/http before and now I need to update to @angular/common/http and use HttpClient I already just make http requests in services (not in components) and that makes them easy to reuse This is what I already have (from deprecated http) return this.http.get(url, {headers: this.headers}).map( (response: Response) => { const data = response.json(); // Does something on data.data // return the modified data: return data.data; } ).catch(

How should I modify the response to an HTTP request and easily access it before return it out from Observable?

被刻印的时光 ゝ 提交于 2021-01-20 15:35:00
问题 I'm upgrading to Angular to version 5, I was using @angular/http before and now I need to update to @angular/common/http and use HttpClient I already just make http requests in services (not in components) and that makes them easy to reuse This is what I already have (from deprecated http) return this.http.get(url, {headers: this.headers}).map( (response: Response) => { const data = response.json(); // Does something on data.data // return the modified data: return data.data; } ).catch(

RxJS - How to incrementally increase the delay time without using interval?

可紊 提交于 2021-01-20 09:24:30
问题 I want to incrementally increase the delay for this: const source = from(839283, 1123123, 63527, 4412454); // note: this is random const spread = source.pipe(concatMap(value => of(value).pipe(delay(1000)))); // how to incrementally increase the delay where the first item emits in a second, the second item emits in three seconds, the third item emits in five seconds, and the last item emits in seven seconds. spread.subscribe(value => console.log(value)); I'm aware of using interval to

How to reset a RXJS scan operator based on another Observable

主宰稳场 提交于 2021-01-20 04:13:53
问题 I have a component which triggers an onScrollEnd event when the last item in a virtual list is rendered. This event will do a new API request to fetch the next page and merge them with the previous results using the scan operator. This component also has a search field which triggers an onSearch event. How do I clear the previous accumulated results from the scan operator when a search event is triggered? Or do I need to refactor my logic here? const loading$ = new BehaviorSubject(false);

How to reset a RXJS scan operator based on another Observable

走远了吗. 提交于 2021-01-20 04:11:26
问题 I have a component which triggers an onScrollEnd event when the last item in a virtual list is rendered. This event will do a new API request to fetch the next page and merge them with the previous results using the scan operator. This component also has a search field which triggers an onSearch event. How do I clear the previous accumulated results from the scan operator when a search event is triggered? Or do I need to refactor my logic here? const loading$ = new BehaviorSubject(false);

Angular 8 Intercept call to refresh token

本秂侑毒 提交于 2021-01-18 10:17:23
问题 I am trying to refresh access token if current access token is expired. I am sending multiple requests at one time and I want to make a kind of a queue, so other requests won't request refreshing token route. I've googled some best practises and examples and found out the following solution for Angular 6 and rxjs v6, which is using BehaviourSubject and switchMaps. (please see attached code) However I am using Angular 8 (8.1) and rxjs v6.4 and this solution does not work for me. It simply does

Angular 8 Intercept call to refresh token

天涯浪子 提交于 2021-01-18 10:11:29
问题 I am trying to refresh access token if current access token is expired. I am sending multiple requests at one time and I want to make a kind of a queue, so other requests won't request refreshing token route. I've googled some best practises and examples and found out the following solution for Angular 6 and rxjs v6, which is using BehaviourSubject and switchMaps. (please see attached code) However I am using Angular 8 (8.1) and rxjs v6.4 and this solution does not work for me. It simply does

Angular 8 Intercept call to refresh token

和自甴很熟 提交于 2021-01-18 10:09:43
问题 I am trying to refresh access token if current access token is expired. I am sending multiple requests at one time and I want to make a kind of a queue, so other requests won't request refreshing token route. I've googled some best practises and examples and found out the following solution for Angular 6 and rxjs v6, which is using BehaviourSubject and switchMaps. (please see attached code) However I am using Angular 8 (8.1) and rxjs v6.4 and this solution does not work for me. It simply does