[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 ...
随机推荐
- php https链接
1.安装soap扩展 2.安装openssL 3.代码执行 function issure($sn){//通过soap链接接口 进行确认是否是正确的sn码 try{ $clie ...
- Lua刚開始学习的人(一)--Lua 简单教学
近期因为工作原因.临时木有<Oracle起步学习>续集.领导知道学习下Lua脚本语言.看了一周了.趁热打铁,留下点实用的东西吧. 本系列会主要针对宿主语言为 Delphi,原理都是一样的, ...
- 改动UINavigationBar (导航栏)上NavigationBarItem 的字体大小和颜色的用法
//创建一个左边button UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithTitle:@"<" ...
- POJ 1904 思路题
思路: 思路题 题目诡异地给了一组可行匹配 肯定有用啊-. 就把那组可行的解 女向男连一条有向边 如果男喜欢女 男向女连一条有向边 跑一边Tarjan就行了 (这个时候 环里的都能选 "增广 ...
- 初识Django框架——环境搭建前你需要了解的几点
Django是一个开放源代码的Web应用框架,由Python写成. 采用了MVC的框架模式,即模型M,视图V和控制器C. 它最初是被开发来用于管理劳伦斯出版集团旗下的一些以新闻内容为主的网站的,即是C ...
- iOS QQ第三方登实现
我们常常会见到应用登陆的时候会有QQ,微信,微博等的第三方登陆 如图: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbHdqb2syMDA3/font/5 ...
- LeetCode 136 Single Number(仅仅出现一次的数字)
翻译 给定一个整型数组,除了某个元素外其余元素均出现两次. 找出这个仅仅出现一次的元素. 备注: 你的算法应该是一个线性时间复杂度. 你能够不用额外空间来实现它吗? 原文 Given an array ...
- iTOP-4412开发板使用
使用环境:win7 旗舰64位,VMware11 使用使用板上提供的ubuntu12.04,用VMWARE直接打开虚拟机,因为之前开发epc9600开发板,所以虚拟机网络已经设置过,加载ubuntu1 ...
- 基于jQuery的一组图片的滚动
css: .displayB{display:block;}.fl{float:left;}.fr{float: right;}.posAb{position: absolute;}.posRe{po ...
- 关于使用toFixed()函数时报错"toFixed() is not a function"的问题
toFixed()函数只有数字类型的参数才可使用,字符串类型的参数需用parseFloat或者parseInt转换后再使用