fix: fix SubscriptionPage crash — align with API response structure

API returns { subscription: {...}|null, used_trial: bool } not flat MySubscription.
- Added MySubscriptionData interface with correct nested shape
- Extract my = myRaw.subscription and usedTrial = myRaw.used_trial separately
- Replace my.used_trial references with usedTrial variable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-14 23:12:22 +03:30
co-authored by Claude Sonnet 4.6
parent 94580894c8
commit ab9d078bf0
2 changed files with 20 additions and 6 deletions
+12
View File
@@ -337,6 +337,18 @@ export interface SubscriptionPeriod {
is_trial: boolean;
}
export interface MySubscriptionData {
subscription: {
plan: { name: string; level: number; features: Record<string, boolean> };
period?: { label: string; duration_months: number };
is_trial: boolean;
starts_at?: number;
expires_at?: number | null;
days_remaining?: number;
} | null;
used_trial: boolean;
}
/** @deprecated use MySubscriptionData */
export interface MySubscription {
plan: { name: string; level: number; features: Record<string, boolean> };
period?: { label: string; duration_months: number };