useAuthStore is a Pinia store that manages user authentication, role-based permissions, and user profile data in the 5Stack platform.
Overview
This store handles:- User authentication state
- Role-based access control
- Discord account linking status
- User profile data management
Import
Usage
State
Current authenticated user object containing profile data, role, and settings.
Indicates whether the user has linked their Discord account.
Methods
getMe()
Fetches and initializes the current user’s data, establishing GraphQL subscriptions for real-time updates.boolean - true if authentication succeeded, false otherwise
Example:
isRoleAbove()
Checks if the current user’s role is at or above the specified role level.The role to check against
boolean - true if user’s role is at or above the specified role
Example:
Computed Properties
true if the user has the base user role.true if the user has the verified_user role.true if the user has the streamer role.true if the user has the match_organizer role.true if the user has the tournament_organizer role.true if the user has the administrator role.Role Hierarchy
The store defines the following role hierarchy (from lowest to highest):user- Base userverified_user- Verified userstreamer- Content creatormatch_organizer- Can organize matchestournament_organizer- Can organize tournamentsadministrator- Full platform access
Real-time Subscriptions
WhengetMe() is called successfully, the store automatically:
- Establishes WebSocket connection
- Subscribes to user profile updates
- Initializes match and tournament subscriptions based on role
- Connects to the Socket.io server for real-time events