// // LoginState.swift // punchnet // // Created by 安礼成 on 2026/1/16. // import Foundation import Observation import SwiftUI @Observable class ResetPasswordModel { enum Stage: Equatable { case requestVerifyCode case submitVerifyCode case resetPassword case success } var stage: Stage = .requestVerifyCode var transitionEdge: Edge = .trailing // 默认从右进入 // 保存内部状态 var phoneNumber: String = "" var sessionId: Int = 0 func requestVerifyCode(phoneNumber: String) async throws -> AuthService.ResetPasswordSession { return try await AuthService.requestResetPasswordVerifyCode(phoneNumber: phoneNumber) } func submitVerifyCode(sessionId: Int, verifyCode: String) async throws -> String { return try await AuthService.submitResetPasswordVerifyCode(sessionId: sessionId, verifyCode: verifyCode) } func resetPassword(sessionId: Int, newPassword: String) async throws -> String { return try await AuthService.resetPassword(sessionId: sessionId, newPassword: newPassword) } }