mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 09:16:41 +02:00
feat(referral): integrate referral system frontend
- Add referral code input to RegisterPage with live validation - Create ReferralWidget for dashboard with stats, code sharing, and tier display - Extend authService.signUp to accept optional referralCode parameter - Add validateReferralCode function to authStore - Create referrals.ts API service for frontend - Add 'referral' widget type to dashboard configuration - Fix drizzle.config.ts to include 'referrals' schema filter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
37039048f4
commit
b148a72e36
9 changed files with 492 additions and 10 deletions
|
|
@ -104,13 +104,21 @@ export function createAuthService(config: AuthServiceConfig) {
|
|||
|
||||
/**
|
||||
* Sign up with email and password
|
||||
* @param email User email
|
||||
* @param password User password
|
||||
* @param referralCode Optional referral code for bonus credits
|
||||
*/
|
||||
async signUp(email: string, password: string): Promise<AuthResult> {
|
||||
async signUp(email: string, password: string, referralCode?: string): Promise<AuthResult> {
|
||||
try {
|
||||
const body: Record<string, string> = { email, password };
|
||||
if (referralCode) {
|
||||
body.referralCode = referralCode;
|
||||
}
|
||||
|
||||
const response = await fetch(`${baseUrl}${endpoints.signUp}`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email, password }),
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue