AJamesPhillips / DataCurator

DataCurator enables you to map and understand complex systems before helping you plan, communicate and navigate successful interventions in them.
https://DataCurator.org
8 stars 1 forks source link

Warn if session expired #168

Closed AJamesPhillips closed 3 years ago

AJamesPhillips commented 3 years ago

Describe the bug

You can use the application, go away, come back, start to use the application and then realise it is not working as your sessions has expired.

To Reproduce

Steps to reproduce the behavior:

  1. Use the app
  2. Leave it for a few hours
  3. Come back, create some new nodes
  4. See it is not working and will have some sync error (usually not a very descriptive one)

Expected behavior

On every action, update the time the application was last used. On returning / refocussing a tab, check this datetime and if longer than 5 (?) minutes, go and check (from the UserInfo component?) with supabase (how?) that the session is still working. If not then reload the page / set the user to undefined.

AJamesPhillips commented 3 years ago

In supabase_update_knowledge_view, the result object from await args.supabase.rpc("update_knowledge_view", ... is:

{
    body: null,
    count: null,
    data: null,
    error: {message: 'JWT expired'},
    status: 401,
    statusText: ""
}
AJamesPhillips commented 3 years ago

Implemented with check_and_handle_connection_and_session