mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: harden gift subscription frontend after multi-agent review
- Handle expired status in GiftResult (stop polling + show FailedState) - Add PollErrorState for balance mode poll errors (softer UX) - Remove non-null assertions in handleSubmit (explicit narrowing) - Wrap gift routes in ErrorBoundary - Add pollErrorTitle/pollErrorDesc i18n keys to all 4 locales
This commit is contained in:
@@ -53,13 +53,22 @@ export interface GiftPurchaseRequest {
|
||||
}
|
||||
|
||||
export interface GiftPurchaseResponse {
|
||||
status: string;
|
||||
status: 'ok' | 'created' | 'paid';
|
||||
purchase_token: string;
|
||||
payment_url: string | null;
|
||||
warning: string | null;
|
||||
}
|
||||
|
||||
export type GiftPurchaseStatusValue =
|
||||
| 'pending'
|
||||
| 'paid'
|
||||
| 'delivered'
|
||||
| 'pending_activation'
|
||||
| 'failed'
|
||||
| 'expired';
|
||||
|
||||
export interface GiftPurchaseStatus {
|
||||
status: string;
|
||||
status: GiftPurchaseStatusValue;
|
||||
is_gift: boolean;
|
||||
recipient_contact_value: string | null;
|
||||
gift_message: string | null;
|
||||
@@ -67,6 +76,15 @@ export interface GiftPurchaseStatus {
|
||||
period_days: number | null;
|
||||
}
|
||||
|
||||
export interface PendingGift {
|
||||
token: string;
|
||||
tariff_name: string | null;
|
||||
period_days: number;
|
||||
gift_message: string | null;
|
||||
sender_display: string | null;
|
||||
created_at: string | null;
|
||||
}
|
||||
|
||||
// API
|
||||
|
||||
export const giftApi = {
|
||||
@@ -84,4 +102,9 @@ export const giftApi = {
|
||||
const { data } = await apiClient.get<GiftPurchaseStatus>(`/cabinet/gift/purchase/${token}`);
|
||||
return data;
|
||||
},
|
||||
|
||||
getPendingGifts: async (): Promise<PendingGift[]> => {
|
||||
const { data } = await apiClient.get<PendingGift[]>('/cabinet/gift/pending');
|
||||
return data;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user