waitForCurrentUser
Overview
Wait until the store holds a successful answer to the current-user request. Use it in custom guards that need to know whether the user is signed in.
While a current-user request is in flight, it waits for that request instead of sending another. When no request has been made, or the last one failed, it sends a new request. When the last request succeeded, it returns at once.
Signature
waitForCurrentUser(pinia)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pinia | Pinia | yes | The Pinia instance. |
Returns
Promise
The user store. Rejects with the request error when the current-user request fails.
Source
client/lib/router/guards.js:52