Events Lifecycle
Overview
Joining an event requires understanding its lifecycle, which consists of three main stages:
Pre-register
Ongoing
Ended
Each stage has unique characteristics affecting how users can interact with the event.
Event Stages
Pre-register Stage
During this stage, the event is published but hasn't started yet.
Key States:
isRegistrationOpen
: Determines if users can join the eventalreadyRegistered
: Indicates if the user has already registered
Characteristics:
Users can register if the registration period is open
Ongoing Stage
The event is live and active during this stage.
Key States:
isLive
: Indicates that the event is active and ongoingisJoinAllowed
: Determines if the user can participateeventStarted
: Confirms that the event has begunmaxParticipationReached
: Indicates if the event has reached its participant limit
Characteristics:
Users can participate if registered and meeting requirements
Ended Stage
The event has concluded in this stage.
Key States:
eventEnded
: Indicates that the event is overisParticipating
: Confirms if the user was a participant
Characteristics:
Users can no longer join
Rewards and results may be available (depending on event type)
Event States: Implementation
JoinStates Type
Use the JoinStates
type to programmatically determine an event's state:
Fetching Join States
Use the getJoinStates
function to check event states:
Joining an Event
🔍 Quick Note: The main function for joining events is
useMutateParticipateEvent
. See example code snippets below for usage details.
Step 1: Event Joining Function
Use the useMutateParticipateEvent
hook to handle user registration:
Function Overview:
Purpose: Joins a user to an event via backend API
Input: Takes
eventId
to identify the eventSuccess Handling: Can trigger UI updates, notifications, or state invalidations
Error Handling: Catches errors like unmet requirements or social bindings
Step 2: Handling Event Requirements
Events may have specific requirements users must meet before joining. These requirements are:
Defined in the event object
Validated by the backend
Enforced to ensure only eligible users can participate
➡️ For more details about requirement schema, client-side validation, and handling, refer to the dedicated Event Requirements documentation.
Step 3: Handling Ongoing Events
Check participation eligibility for ongoing events:
Summary
The event joining process involves:
Checking the event's current stage
Verifying user eligibility
Handling any specific requirements
Managing state transitions
Providing appropriate user feedback
For detailed implementation examples and best practices, refer to the code snippets above and ensure proper error handling for all scenarios.
Last updated