openmrs-esm-core

O3 Framework / refetchCurrentUser

Function: refetchCurrentUser()

refetchCurrentUser(username?, password?): Promise<SessionStore>

Defined in: packages/framework/esm-api/src/current-user.ts:251

The refetchCurrentUser function causes a network request to redownload the user. All subscribers to the session store will be notified of the new user once the new version of the user object is downloaded.

If the server rejects the request as unauthenticated (401 or 403), the store records a logged-out session. If the request fails for any other reason, a session that has already loaded is kept; otherwise the store records the error.

Parameters

username?

string

password?

string

Returns

Promise<SessionStore>

A Promise resolving to the updated session store state. It rejects with the store state if the request fails for a reason other than authentication.

Example

import { refetchCurrentUser } from '@openmrs/esm-api'
refetchCurrentUser()