How to Clear IndexedDB and Offline Data on Logout in a Mendix Tablet offline PWA?

0
Hi everyone,I'm using a Mendix PWA with offline capabilities. When a user logs out, I want to completely clear all locally stored data, including the Offline Database (IndexedDB), so that no offline data remains in the browser.The reason is that when the same user (or a different user) logs in again, I want the application to download a fresh copy of all data from the server instead of reusing any previously cached offline data.Is there a supported or recommended way to achieve this in Mendix?Can the Offline Database (IndexedDB) be cleared during the logout process?What is the recommended best practice to ensure the next login always retrieves fresh data from the server?Any suggestions or examples would be greatly appreciated.Thank you!
asked
1 answers
0

Hi Kavin,


For this you need to follow two steps.

In a nanoflow before sign out you need to

  1. Synchronize everything activity, ( so you don't loose your users valuable data)
  2. Clear from Device activity ( for every entity which data needs to be cleared)

!! [ If you have 10 entity then 10 times call clear from device ]


And after login you can syncrhonize all the data as per you requirements.

Hope it helps.

answered