Which actions should be replayed? I guess only those are modyfying data on backend like:
- POST
- PUT
- DELETE
When request failed we should save it somewhere in store, I think store should look like this
| chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#ttl=Inversion%20of%20Control%20Containers%20and%20the%20Dependency%20Injection%20pattern&pos=1208&uri=https://www.martinfowler.com/articles/injection.html | |
| chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#ttl=LEARNING%20PATH%3A%20iPhone%20Programming%20with%20iOS%2011%20and%20Swift%204%20%7C%20Learning%20Paths&pos=0&uri=https://www.safaribooksonline.com/learning-paths/learning-path-iphone/9781789611588/ | |
| chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#ttl=Are%20pointers%20and%20arrays%20equivalent%20in%20C%3F%20-%20Eli%20Bendersky's%20website&pos=4035&uri=https://eli.thegreenplace.net/2009/10/21/are-pointers-and-arrays-equivalent-in-c | |
| chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#ttl=Professional%20C%20Programming%20LiveLessons%20(Video%20Training)%2C%20Part%20I%3A%20Writing%20Robust%2C%20Secure%2C%20and%20Reliable%20Code&pos=0&uri=https://learning.oreilly.com/videos/professional-c-pr |
| 1) https://leetcode.com/problems/two-sum/ | |
| sum([1, 2, 5, 3, 4], 9) -> [2, 4] | |
| find closest sum | |
| sum([1, 8, 5, 6, 4], 15) -> [1, 3] | |
| 2) rotateMatrix([ | |
| [1, 2], | |
| [3, 4] | |
| ]); | |
| Result |
| class GlassCertonaWithOverlap extends Component { | |
| state = { | |
| deviceSize: 0, | |
| cardSize: 0, | |
| style: {} | |
| } | |
| getCardImage = card => { | |
| const { clientWidth } = card.querySelector('img') | |
There are basicly 2 scenarious for create:
First case
| class MyPromise { | |
| constructor(handler) { | |
| this.status = 'pending'; | |
| if (!handler) { | |
| throw new TypeError('Promise resolver is undefined'); | |
| } | |
| handler(value => { | |
| this.value = value; |
| /* API usage */ | |
| import initApi from 'redux-wp'; | |
| initApi(store); | |
| /* Somewhere in the user code */ | |
| import getPost from 'wp-redux' | |
| getPost(2, 'posts') | |
| .then(post => console.log(post)); |
| /* API usage */ | |
| import makeApi from 'redux-wp'; | |
| const api = makeApi(store); | |
| api.getPost(2, 'posts') | |
| .then(post => console.log(post)); | |
| /* Implementation */ |
Collection GET /wp/v2/posts Response [{id: 1, name: 'post'}, {id: 2, name: 'post2'}]
Signle entity GET /wp/v2/posts/1 Response {id: 1, name: 'test'}
Object collection GET /wp/v2/taxonomies Response { testA: { name: 'test a' }, testB: {name: 'test b'}, testC: { name: 'test c' }}
How will look store for different actions, READ, READ_FAIL, READ_SUCCESS ?
| { | |
| posts: { | |
| 1: { | |
| data: { | |
| id: 1, | |
| title: test | |
| }, | |
| ststus: 'success' | |
| } | |
| } |