Hello,
I want to update user info from my profile app, my user data are name and email, I want to edit only name profile but when I edited it, I should exit from the account and log in again.
if I do not this, my new account data not loading
Hello @saeed_noshadi
Why should you exit from the account and log in again.
? Is it a bug or it’s by design?
Please provide us steps to reproduce and we will investigate your case.
Also, would be nice if you share with us request’s result(error) for this point:
if I do not this, my new account data not loading
Regards, Vlad
Hello.
I have same problem in iOS. I change user properties in server code (codeless) and my current user on client stay with old properties if I do not relogin. What I should make in this situation? How I can update current user on client without relogin?
" Why should you exit from the account and log in again.
? Is it a bug or it’s by design?
Please provide us steps to reproduce and we will investigate your case.
Also, would be nice if you share with us request’s result(error) for this point:"
Is it not clear why? I understood with my poor English. If he does not relogin, then his current user on client remains with the old properties. The current user on client does not synchronize with the data on the backendless.
For reproduce this problem, change, please, any custom properties (not password or id) of current user in console and update current user on client without relogin
Now I see what you are talking about.
Alright, to synchronize currentUser
on the client with user object on the server you have two options:
- using RealTime (RT) listeners, just subscribe on
data changes
for the object in Users table and each time when you receive this event update properties in yourcurrentUser
on the client
const currentUser = await Backendless.UserService.getCurrentUser()
const rtHandlers = Backendless.Data.of('Users').rt()
rtHandlers.addUpdateListener("objectId = 'YOUR_CURRENT_USER_ID'", updatedUser => {
currentUser.name = updatedUser.name
currentUser.email = updatedUser.email
....
})
- retrieve up-to-date user object and merge it into your
currentUser
time to time with interval or after specific request
const currentUser = await Backendless.UserService.getCurrentUser()
const updateUser = await Backendless.Data.of('Users').findById(currentUser.objectId)
currentUser.name = updatedUser.name
currentUser.email = updatedUser.email
....
does it make sense?
Regards, Vlad
Yes, thanks)