Where to save user-related parameter settings

I have an application in which a user logs in and uses several functions. In the meantime, he can configure some settings on the corresponding screen (receive push notifications, messages on facebook, message on twitter).

I am wondering where to save these settings in order to stick with a registered user, so that when another user logs in, he can configure his own settings. Etc.

If I store these values ​​in localStorage, they will always be associated with the LAST registered by the user, which is not a convenient way.

So, should I store such data in my backend tables? (I use parse BTW) and retrieve them every time a user logs in? Or is there another way to do this?

thank

+4
source share
2 answers

You can save these settings in localStorage(or any other permanent storage), but specify each parameter to the user or save the settings in the cloud. The latter works well if users can expect that their settings will follow them on other devices that they use, but you need to be very clear that you are doing this .

As for saving local settings, why not?

localStorage.setItem ( userName, JSON.stringify( { postToTwitter: true, postToFacebook, false, ... } ) );

And later, to get:

var userSettings = JSON.parse(localStorage.getItem ( userName )); if (userSettings.postToTwitter) { ... }

+6
source

localStorage. , .

, .

0

Source: https://habr.com/ru/post/1539194/


All Articles