Issue with API Fields updating instantly within Nav Bar App



Publication le 13 juil. 2022

I'm using client.request() to update a Users Suspension status however it does not update until the iframe is exited or the page is completely refreshed. Is there a solution to updating this instantly so it can reflect within the app?

Here is my current code:

function suspendUser(userID){
    const options = {
  url: '/api/v2/users/'+ userID,
  type: 'PUT',
  data: JSON.stringify({
    user: {
      suspended: true
    }
  }),
  contentType: 'application/json'
};

client.request(options).then(
  (res) => {
    console.log(`Suspended user ${res.user.id}`);
    client.invoke('notify',`Suspended user ${res.user.name}`, 'notice');
    reloadUsers();
  },
  (res) => {
    console.log(`Error ${res.status}`);
    client.invoke('notify',`Error ${res.status}`, 'notice')
  }
);
}


0

6

0 commentaire

      Se connecter pour laisser un commentaire.

      Vous ne trouvez pas ce que vous cherchez ?

      Nouvelle publication