Reputation: 151
I want to update my content on same page, but after server update it shows old data
Name : Arnold Schwarzenegger
after i update my data Arnold Schwarzenegger to Schwarzenegger using redux-from, Its changed on server but it shows Arnold Schwarzenegger on page
After success, i want to replace state with new data, in my case i am using
EDIT
case 'EDIT_REQUEST':
return {} // checking the id is same or not using action ID
case 'EDIT_SUCCESS': // after server update
return {} // i want to change data using action id,
unfortunately action is not available her
case 'EDIT_FAILURE':
return {}
Upvotes: 3
Views: 205
Reputation: 101
Check what your server returns and assign that to actions payload then at the reducer do something like this.
case 'EDIT_SUCCESS': return { yourState: action.payload }
Upvotes: 0
Reputation: 1073
after i update my data Arnold Schwarzenegger to Schwarzenegger using redux-from, Its changed on server but it shows Arnold Schwarzenegger on page
it's means your server return with old data, please check your update or findOneAndUpdate have { new: true }
Upvotes: 1