Feature: Referral-System — User wirbt User

- DB: referral_code (8-stellig, eindeutig) + referred_by zu users
  Bestehende User erhalten automatisch einen Code
- GET /api/auth/referral: Code, Link und Anzahl geworbener User
- POST /api/auth/register: ref_code Parameter für Zuordnung
- Settings: 'App empfehlen'-Karte mit Link, Teilen-Button und Botschafter-Badges
  (Botschafter ab 1, Super ab 5, Top ab 10 Einladungen)
- app.js: ?ref=CODE aus URL in sessionStorage speichern
- APP_VER 222, SW by-v244
This commit is contained in:
rene 2026-04-19 11:09:24 +02:00
parent 82d9e26823
commit 6d757b86c2
6 changed files with 121 additions and 7 deletions

View file

@ -78,8 +78,10 @@ const API = (() => {
login(email, password) {
return post('/auth/login', { email, password });
},
register(email, password, name) {
return post('/auth/register', { email, password, name });
register(email, password, name, ref_code) {
const body = { email, password, name };
if (ref_code) body.ref_code = ref_code;
return post('/auth/register', body);
},
logout() {
localStorage.removeItem('by_token');
@ -88,6 +90,7 @@ const API = (() => {
me() {
return get('/auth/me');
},
referral: () => get('/auth/referral'),
};
// ----------------------------------------------------------