To reduce amount of HTTP request some data can be save to local storage.
[x] save
[x] get
Save (put)
This side effect should take place in middleware
Retrieve (get)
Here two options:
Retrieve saved data in middleware before FETCH (and if data is available - don't make a request)
OR
Fill store with data on application bootstrap. In this case an initialState that is passing down to sore (then it's creating) should be filled with data.
More detailed description:
Dictionaries
All dictionaries must be save to localstorage (for now there only of of them - see src/modules/dictionaries/constants.js)
Time to save - e.g. 2 week.
There should not be an HTTP request if data was already loaded.
it's already in a store or
it's can be taken from local storage (and data from local storage) is not expired.
Statistics
All statistics data need to be save to local storage (see src/modules/statistics/constants.js for list of available statistics)
Time to save - e.g. 1 day.
There should not be an HTTP request if data was already loaded before:
it's already in a store or
it's can be taken from local storage (and data from local storage) is not expired.
To reduce amount of HTTP request some data can be save to local storage.
Save (put)
This side effect should take place in middleware
Retrieve (get)
Here two options:
initialState
that is passing down to sore (then it's creating) should be filled with data.More detailed description:
Dictionaries
All dictionaries must be save to localstorage (for now there only of of them - see
src/modules/dictionaries/constants.js
) Time to save - e.g. 2 week.There should not be an HTTP request if data was already loaded.
it's can be taken from local storage (and data from local storage) is not expired.
Statistics
All statistics data need to be save to local storage (see
src/modules/statistics/constants.js
for list of available statistics) Time to save - e.g. 1 day.There should not be an HTTP request if data was already loaded before:
Auth token
should be save to cookie
Timeperiod id
should be save to cookie