[RxJS] Avoid mulit post requests by using shareReplay()
With the shareReplay
operator in place, we would no longer fall into the situation where we have accidental multiple HTTP requests.
And this covers the main use cases for doing the most typical read and modification operations, that we would implement while doing a custom REST API.
import 'rxjs/add/operator/shareReplay'; signUp(email: string, password: string) {
return this.http.post<User>('/api/signup', {
email,
password
}).shareReplay() // make sure that request was cached and it return observable
.do((user) => this.subject.next(user));
}
shareReplay was added to RxJS V5.4
More informaiton about shareReplay.
[RxJS] Avoid mulit post requests by using shareReplay()的更多相关文章
- [RxJS] Reactive Programming - New requests from refresh clicks -- merge()
Now we want each time we click refresh button, we will get new group of users. So we need to get the ...
- [Vue-rx] Disable Buttons While Data is Loading with RxJS and Vue.js
Streams give you the power to handle a "pending" state where you've made a request for dat ...
- dfsdf
This project was bootstrapped with Create React App. Below you will find some information on how to ...
- puppeteer(五)chrome启动参数列表API
List of Chromium Command Line Switches https://peter.sh/experiments/chromium-command-line-switches/ ...
- CEF 支持的命令行参数
参考:https://peter.sh/experiments/chromium-command-line-switches/ List of Chromium Command Line Switch ...
- SpringKafka生产端配置类ProducerConfig.java源码
/** * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreeme ...
- Capabilities & ChromeOptions
https://sites.google.com/a/chromium.org/chromedriver/capabilities http://stackoverflow.com/questions ...
- List of Chromium Command Line Switches(命令行开关集)——官方指定命令行更新网址
转自:http://peter.sh/experiments/chromium-command-line-switches/ There are lots of command lines which ...
- OBD Problem Vehicles
This page contains a list of vehicles that are known to be non-compliant with OBD-II in one way or a ...
随机推荐
- lsblk---列出所有可用块设备的信息,
lsblk命令用于列出所有可用块设备的信息,而且还能显示他们之间的依赖关系,但是它不会列出RAM盘的信息.块设备有硬盘,闪存盘,cd-ROM等等.lsblk命令包含在util-linux-ng包中,现 ...
- stat---显示文件的状态信息
stat命令用于显示文件的状态信息.stat命令的输出信息比ls命令的输出信息要更详细. 语法 stat(选项)(参数) 选项 -L:支持符号连接: -f:显示文件系统状态而非文件状态: -t:以简洁 ...
- PHP解析XML格式文档
<?php// 首先要建一个DOMDocument对象$xml = new DOMDocument();// 加载Xml文件$xml->load("3.xml");// ...
- K-近邻算法学习
# -- coding: utf-8 -- from numpy import * import operator def createDataSet(): group = array([[1.0,1 ...
- RTP 和 RTSP的区别
RTP(Real-time Transport Protocol)是用于Internet上针对多媒体数据流的一种传输协议.RTP被定义为在一对一或一对多的传输情况下工作.其目的是提供时间信息和实现流同 ...
- sql创建外键
建立外键关系:先建主表再见从表:主表:create table zhu(code int parimary key,name varchar(20)) ;从表:create table cong(co ...
- 初识Oracle中的正则表达式
Oracle使用正则表达式离不开这4个函数: 1.regexp_like 2.regexp_substr 3.regexp_instr 4.regexp_replace
- JavaScript--数据结构与算法之集合
集合(Set):是一种包含不同元素的数据结构. 重要特性:1.集合中的成员时无序的:2.集合中不允许相同的成员存在. 使用场景:用于存储一些独一无二的元素. 1 集合的定义:(和高中数学中的集合一样) ...
- 在Xampp中添加memache扩展
1.首先下载phpmemcache,地址为: http://up.2cto.com/2012/0522/20120522094758371.rar 解压下的文件,解压后有以下文件: 接着以管理员身份打 ...
- .Net 程序在自定义位置查找托管/非托管 dll 的几种方法
原文:.Net 程序在自定义位置查找托管/非托管 dll 的几种方法 一.自定义托管 dll 程序集的查找位置 目前(.Net4.7)能用的有2种: #define DEFAULT_IMPLEMENT ...