Skip to content

fetchCurrentUser ​

Overview ​

Fetches the current user from the who-is endpoint and updates the login state and currentUserRequestStatus. When the authenticated user changes, clears the authorization-dependent stores and increments identityGeneration.

Only the newest request writes the user fields and currentUserRequestStatus. The promise of an older request settles with the newest request's outcome, so a caller that awaits it reads the newest answer.

Signature ​

fetchCurrentUser(options)

Parameters ​

NameTypeRequiredDescription
optionsobjectnoFetch options.

options Properties ​

NameTypeRequiredDefaultDescription
preserveErrorbooleanWhether to leave the store-wide error and errored unchanged, on success and on failure. currentUserRequestStatus records the outcome either way.

Returns ​

Promise

Resolves once the state is updated; rejects with the request error.

Source ​

client/lib/stores/storeUser.js:214