---
url: "https://vueda.dev/v3/reference/api/js/stores/storeUser/methods/fetchCurrentUser.md"
title: "fetchCurrentUser"
---

# 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

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| <span id="param-options">options</span> | `object` | no | Fetch options. |

#### options Properties

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="param-options-preserveError">preserveError</span> | `boolean` |  |  | Whether 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`
