Is there any good solution to the loss of local store data after using KOA2+Sequelize+redux to access the remote interface?

problem description

use KOA2+Sequelize to make a simple todo column, access the remote interface, add and modify actions, and the local store data is emptied

the environmental background of the problems and what methods you have tried

search Baidu, find local persistence using redux-persist, and take a look at its implementation, which does not meet the requirements.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
this is the data read from the database
/ , store,no data/ , store,no data
,,,,

what result do you expect? What is the error message actually seen?

do you know a better way?

May.22,2021

well, if there is nothing wrong with api, you should check which part of action and reducer, is probably wrong with reducer. It is recommended to paste the code.


problem solved. When a request is made in reducer, NULL, is considered to have cheated itself.
`function Requesting (state) {

return immutable.fromJS(state).merge({
    isRequesting: true,
    data: null,
    error: null
}).toJS();

} `
data:null is modified to data:state.data to return data correctly

Menu