API reference
useAuthStore
The session store: user, login, logout and the demo role.
stores/auth.ts
Pinia stores use the Composition API and are auto-imported. The session is the auth-session cookie, so it works on the server.
useAuthStore()
Returns user, isAuthenticated, fullname, welcomeMessage, isDemoRole, login(email, remember), logout() and setDemoRole(id).
const useAuthStore: SetupStoreDefinition<"auth", { user: any; isDemoRole: any; isAuthenticated: any; fullname: any; welcomeMessage: any; login: (email: string, remember?: boolean) => void; logout: ()…AUTH_HOME_ROUTE
Where users land after signing in.
const AUTH_HOME_ROUTE: "/dashboard/analytics"
AUTH_LOGIN_ROUTE
The login route guests are sent to.
const AUTH_LOGIN_ROUTE: "/login"
AUTH_COOKIE_KEY
The session cookie name.
const AUTH_COOKIE_KEY: "auth-session"
AUTH_ROLE_COOKIE_KEY
The demo role cookie name.
const AUTH_ROLE_COOKIE_KEY: "auth-demo-role"