Cache facility list when user logs in

Description

When a user logs in, we should cache minimal data about the facilities so that other services and APIs don't have to fetch simple data such as facility name and UUID.

Acceptance Criteria

  • When logged in, UI fetches and saves list of facilities

    • When the UI loads, and there is no list of facilities, the UI will download the facilities

  • When user logs out, the list of facilities is removed from local storage

Activity

Show:
Nick Reid
August 29, 2017, 4:16 AM

I've just pushed the first bit of this functionality (it doesn't currently clear data when you logout)

Here is how you get the cached minimal facilities list

  • short answer, pretend you are getting it from the server – if there is a cached copy, it will return that list – otherwise it will make a http request and such like

If I were you, I'd add this to the routers resolve

Bug if you don't know what I'm talking about (and he might complain about how vague I am) XD

Sebastian Brudziński
August 29, 2017, 8:40 AM

please take a look at Nick's comment.

Nick Reid
August 29, 2017, 3:21 PM

– lets chat today about how to test this, because there is nothing that should be distinctly user visible about this ticket....

Chongsun Ahn
August 31, 2017, 7:39 PM

Tested on test in both Firefox and Chrome. Checked localStorage openlmis.referencedataMinimalFacilities and on login, the facilities were populated. On logout, the facilities are emptied. Moving this to Done.

Done

Assignee

Nick Reid

Reporter

Nick Reid

Labels

None

Story Points

2

Components

Sprint

None

Fix versions

Priority

Major