Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Last active October 30, 2022 13:49
Show Gist options
  • Save NetanelBasal/8baac19de444c51776c6b7cf191aa49b to your computer and use it in GitHub Desktop.
Save NetanelBasal/8baac19de444c51776c6b7cf191aa49b to your computer and use it in GitHub Desktop.
import { repeat, filter, take } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class FooService {
private http = inject(HttpClient);
doSometing(data) {
return this.http.post('https://foo', data)
.pipe(
repeat({ delay: 1000 }),
filter((res) => res.status === 'completed'),
take(1)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment