feat(user): sync entitlement snapshot
This commit is contained in:
@@ -69,6 +69,9 @@ export class ApiPath {
|
||||
/** 查询积分操作历史 */
|
||||
static readonly userCreditsHistory = `${ApiPath._user}/credits/history`;
|
||||
|
||||
/** 获取当前用户权益快照 */
|
||||
static readonly userEntitlements = `${ApiPath._user}/entitlements`;
|
||||
|
||||
// ============ 支付相关 ============
|
||||
/** 创建充值订单 */
|
||||
static readonly paymentCreateOrder = `${ApiPath._payment}/create-order`;
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
CreditsHistoryData,
|
||||
UpdateProfileRequest,
|
||||
User,
|
||||
UserEntitlements,
|
||||
UserStatsResponse,
|
||||
} from "@/data/dto/user";
|
||||
import type { UserData } from "@/data/schemas/user/user";
|
||||
@@ -69,6 +70,14 @@ export class UserApi {
|
||||
unwrap(env) as Record<string, unknown>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户权益快照
|
||||
*/
|
||||
async getEntitlements(): Promise<UserEntitlements> {
|
||||
const env = await httpClient<ApiEnvelope<unknown>>(ApiPath.userEntitlements);
|
||||
return UserEntitlements.fromJson(unwrap(env) as Record<string, unknown>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user