(inviteCode: string)
| 62 | } |
| 63 | |
| 64 | async function tryClaimInviteCode(inviteCode: string): Promise<void> { |
| 65 | const response = await backendFetch("/api/v1/account/invite/claim", { |
| 66 | method: "POST", |
| 67 | headers: { |
| 68 | "Content-Type": "application/json", |
| 69 | }, |
| 70 | body: JSON.stringify({ invite_code: inviteCode }), |
| 71 | }); |
| 72 | |
| 73 | const data = await response.json().catch(() => null); |
| 74 | if (!response.ok) { |
| 75 | const detail = data?.detail || "邀请码兑换失败,请稍后重试"; |
| 76 | throw new Error(detail); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | // Note: We use relative paths ("/api/...") which go through Vite proxy in dev mode |
| 81 | // This allows the backend URL to be configured at proxy level, not hardcoded here |
no test coverage detected