fix: bug
This commit is contained in:
44
lib/auth.ts
44
lib/auth.ts
@@ -70,10 +70,54 @@ export interface BillingPortalResponse {
|
||||
redirect: boolean
|
||||
}
|
||||
|
||||
export interface PlansParams {
|
||||
query: {
|
||||
id: string
|
||||
key: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface CreateSubscriptionParams {
|
||||
priceId: string
|
||||
productId: string
|
||||
successUrl: string
|
||||
cancelUrl: string
|
||||
}
|
||||
|
||||
export interface UpgradeSubscriptionParams {
|
||||
plan: string
|
||||
subscriptionId: string
|
||||
successUrl: string
|
||||
cancelUrl: string
|
||||
}
|
||||
|
||||
export interface CancelSubscriptionParams {
|
||||
subscriptionId: string
|
||||
referenceId: string
|
||||
}
|
||||
|
||||
export interface TopupParams {
|
||||
amount: number
|
||||
priceId: string
|
||||
successUrl: string
|
||||
cancelUrl: string
|
||||
}
|
||||
|
||||
export interface CheckoutResponse {
|
||||
url?: string
|
||||
}
|
||||
|
||||
export interface ISubscription {
|
||||
list: (params?: SubscriptionListParams) => Promise<{ data?: SubscriptionListItem[]; error?: ApiError }>
|
||||
plans: (params: PlansParams) => Promise<{ data?: any; error?: ApiError }>
|
||||
create: (params: CreateSubscriptionParams) => Promise<{ data?: CheckoutResponse; error?: ApiError }>
|
||||
upgrade: (params: UpgradeSubscriptionParams) => Promise<{ data?: any; error?: ApiError }>
|
||||
cancel: (params: CancelSubscriptionParams) => Promise<{ data?: any; error?: ApiError }>
|
||||
restore: (params?: SubscriptionRestoreParams) => Promise<{ data?: SubscriptionRestoreResponse; error?: ApiError }>
|
||||
billingPortal: (params?: BillingPortalParams) => Promise<{ data?: BillingPortalResponse; error?: ApiError }>
|
||||
credit: {
|
||||
topup: (params: TopupParams) => Promise<{ data?: CheckoutResponse; error?: ApiError }>
|
||||
}
|
||||
}
|
||||
// 统一的 Token 存储键名(与 fetch-logger.ts 保持一致)
|
||||
export const getAuthToken = async () => (await storage.getItem(TOKEN_KEY)) || ''
|
||||
|
||||
Reference in New Issue
Block a user