0.1.2 • Published 7 years ago
shared_store v0.1.2
Publish analysis shared store
install
yarn add shared_store
usage
import reducer
import { inProcessPosts } from 'shared_store';
Then add the inProcessPosts
to your redux root reducers.
import actions
import { updatePosts, deletePost, updatePost } from 'shared_store';
use updatePosts
- Apply empty object
dispatch(updatePosts({})); // empty object is allowed, it won't effect the updatePosts's state
- Apply object with instances -- updatePosts({ symbol_id_1 : instance_1, symbol_id_2 : instance_2...})
For every instance, the symbol_id,symbol:{name,accuracy,id},chart_img_in_base64,customized_data
are required fields. The symbol.id
field should be the same with symbol_id
.
dispatch(updatePosts({
1 : {
symbol_id : 1,
symbol : {
name : 'AUDCAD',
accuracy : 0.0001,
id : 1
},
chart_img_in_base64 : '',
customized_data : {},
},
2 : {
symbol_id : 2,
symbol : {
name : 'EURUSD',
accuracy : 0.0001,
id : 2
},
chart_img_in_base64 : '',
customized_data : {},
}
}))
use updatePost -- updatePost(symbol_id, instance)
dispatch(updatePost ( 2, {
"symbol" : {
"accuracy" : 0.0001,
"id" : 2,
"name" : "EURUSD"
},
"chart_img_in_base64" : "",
"customized_data" : {},
"symbol_id" : 2,
title : 'Oil trending for the next 3 months',
content : 'fill in the future'
} ))