3

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 {}
Harry Edward
  • 141
  • 2
  • 2
  • 14

2 Answers2

1

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 }

Shanu T Thankachan
  • 993
  • 2
  • 8
  • 16
0

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 }

Jhm
  • 101
  • 3