mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-30 23:14:37 +00:00
Add invite codes feature (#94)
* Refactor import statement in store configuration for clarity - Combined the import of `configureStore` and `Middleware` from '@reduxjs/toolkit' into a single line for improved readability. * Add invite codes feature with onboarding step and dedicated page Implement frontend for the invite codes system: users get 5 invite codes to share, can redeem codes for free credits, and new users are prompted during onboarding (step 1) to enter an invite code. - Add invite types, API service, and Redux slice - Add InviteCodeStep as first onboarding step (skip-able) - Add /invites page with redeem input and code list with copy buttons - Add "Invite Friends" nav item to sidebar - Update UserReferral interface to match backend PR #418 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Update reqwest dependency to enable HTTP/2 support and switch to rustls TLS in network requests - Modified Cargo.toml to include the "http2" feature for reqwest. - Updated network request implementations in bridge and ops_net modules to use rustls TLS instead of native TLS for improved security and compatibility. * Update event loop to handle async tool calls and improve message processing - Introduced a `PendingToolCall` struct to manage in-flight async tool calls. - Enhanced the event loop to check for completion of async tool calls and handle timeouts. - Updated message handling to support async tool execution, allowing the event loop to process other messages concurrently. - Refactored `handle_tool_call` to differentiate between synchronous and asynchronous tool results. - Modified JavaScript fetch functions to use async/await for improved readability and performance. * Enhance skill instance with initial ping verification and job driving - Added an immediate ping to verify the connection health during skill execution, logging the result or any errors encountered. - Updated the event loop to drive jobs asynchronously after the initial ping check. - Removed unnecessary logging statements from the network operations for cleaner output. * Update subproject commit reference in skills directory --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
969503eec2
commit
e23b3643bd
@@ -0,0 +1,28 @@
|
||||
import type { ApiResponse } from '../../types/api';
|
||||
import type { InviteCode } from '../../types/invite';
|
||||
import { apiClient } from '../apiClient';
|
||||
|
||||
export const inviteApi = {
|
||||
/** GET /invite/my-codes — list user's 5 invite codes with usage history */
|
||||
getMyInviteCodes: async (): Promise<InviteCode[]> => {
|
||||
const response = await apiClient.get<ApiResponse<InviteCode[]>>('/invite/my-codes');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/** POST /invite/redeem — redeem an invite code */
|
||||
redeemInviteCode: async (code: string): Promise<{ message: string }> => {
|
||||
const response = await apiClient.post<ApiResponse<{ message: string }>>('/invite/redeem', {
|
||||
code,
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/** GET /invite/status?code=X — check if an invite code is valid (no auth required) */
|
||||
checkInviteCode: async (code: string): Promise<{ valid: boolean }> => {
|
||||
const response = await apiClient.get<ApiResponse<{ valid: boolean }>>(
|
||||
`/invite/status?code=${encodeURIComponent(code)}`,
|
||||
{ requireAuth: false }
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user