Skip to content

storeUser

Overview

The user store, handling user login, logout, and current user fetching.

Signature

storeUser(pinia, hot)

Parameters

NameTypeRequiredDescription
piniaPinianoPinia instance to retrieve the store
hotStoreGenericnodev only hot module replacement

Returns

Store

Examples

js
  import { storeUser } from "@vueda";
  const user = storeUser();

  user.loggedIn; // reactive boolean for login state, true if logged-in
  user.loggedInUser; // reactive object for user details
  user.initialized; // reactive boolean for initialization state, true if initialized
  user.loading; // reactive boolean for loading state, true if loading
  user.error; // reactive object for error details
  user.errored; // reactive boolean for error state, true if errored
  user.initializingPromise; // promise for initialization

  user.init(); // fetch the current user, with initialization wrapping
  user.login({username: "username", password: "password"}); // login
  user.forgotPassword({email: "password"}); /
  user.resetPassword({password: "password", password_confirm: "password_confirm"});
  user.checkResetLinkIsValid(); // login
  user.logout(); // logout
  user.fetchCurrentUser(); // fetch the current user

Properties

$id

Id of the store. Used by map helpers.

Type: "user"

Source: node_modules/.pnpm/pinia@3.0.4_typescript@5.9.3_vue@3.5.27_typescript@5.9.3_/node_modules/pinia/dist/pinia.d.ts:654

Source

client/lib/stores/storeUser.js:117

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2