Skip to content

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 ​

NameTypeRequiredDescription
piniaPiniayesThe 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