feat: 新增用户设置和默认账户管理服务,包含获取、更新及清除/设置默认账户功能。

This commit is contained in:
2026-02-02 13:03:59 +08:00
parent a959080a01
commit 2b6e92f03c

View File

@@ -29,6 +29,9 @@ function mapSettingsResponse(data: any): UserSettings {
// Add these just in case they are returned in the main object
defaultExpenseAccountId: data.default_expense_account_id,
defaultIncomeAccountId: data.default_income_account_id,
phone: data.phone,
email: data.email,
notificationChannel: data.notification_channel,
};
}
@@ -64,6 +67,9 @@ export async function updateSettings(data: Partial<UserSettings>): Promise<UserS
if (data.showReimbursementBtn !== undefined) payload.show_reimbursement_btn = data.showReimbursementBtn;
if (data.showRefundBtn !== undefined) payload.show_refund_btn = data.showRefundBtn;
if (data.currentLedgerId !== undefined) payload.current_ledger_id = data.currentLedgerId;
if (data.phone !== undefined) payload.phone = data.phone;
if (data.email !== undefined) payload.email = data.email;
if (data.notificationChannel !== undefined) payload.notification_channel = data.notificationChannel;
const response = await api.put<ApiResponse<any>>('/settings', payload);
if (!response.data) {