Recent searches
No recent searches
Issue with API Fields updating instantly within Nav Bar App
Posted Jul 13, 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 comments
Eric Nelson
Are you saying that the user suspension event doesn't happen until the app refreshes or just the UI?
Thanks!
0
Gaby Bitar
Eric Nelson Yes, the user suspension event doesn't happen until the app refreshes. Even if I use location.reload(); it doesn't work until the page refreshes completely.
0
Eric Nelson
What do you have kicking off that function? I haven't been able to replicate your issue. Here is a small example application that is functioning as expected. Hopefully this can point you in the right direction.
Thanks,
Eric
0
Gaby Bitar
Eric Nelson I tried using this and I am still getting the same issue. As I do get a success popup notification saying the user was suspended, it doesn't update the API instantly, it updates after the app is refreshed.
0
Eric Nelson
0
Gaby Bitar
Eric Nelson I don't need to suspend users anymore and tried it with updating the User's custom roles and that updates instantly. There must be something with the Suspension field that delays in updating but luckily I don't need that right now. Thank you so much for your help again!
0