migrate session list page /user security page to composition API and typescript

This commit is contained in:
MaysWind
2025-01-21 23:38:06 +08:00
parent 568abb6e03
commit e053528abf
6 changed files with 397 additions and 373 deletions
+10 -3
View File
@@ -16,7 +16,14 @@ import { useStatisticsStore } from './statistics.js';
import { useExchangeRatesStore } from './exchangeRates.ts';
import type { AuthResponse, RegisterResponse } from '@/models/auth_response.ts';
import type { User, UserLoginRequest, UserResendVerifyEmailRequest, UserVerifyEmailResponse, UserProfileUpdateResponse } from '@/models/user.ts';
import type {
User,
UserLoginRequest,
UserResendVerifyEmailRequest,
UserVerifyEmailResponse,
UserProfileUpdateRequest,
UserProfileUpdateResponse
} from '@/models/user.ts';
import type { LocalizedPresetCategory } from '@/core/category.ts';
import type { ForgetPasswordRequest } from '@/models/forget_password.ts';
@@ -370,9 +377,9 @@ export const useRootStore = defineStore('root', () => {
});
}
function updateUserProfile({ profile, currentPassword }: { profile: User, currentPassword?: string }): Promise<UserProfileUpdateResponse> {
function updateUserProfile(req: UserProfileUpdateRequest): Promise<UserProfileUpdateResponse> {
return new Promise((resolve, reject) => {
services.updateProfile(profile.toProfileUpdateRequest(currentPassword)).then(response => {
services.updateProfile(req).then(response => {
const data = response.data;
if (!data || !data.success || !data.result) {