refactor: 更新 EPLoginTypesViewController 以简化表单验证和错误处理
主要变更: 1. 将 EPLoginTypesViewController 继承自 BaseViewController,提升代码结构。 2. 简化表单验证逻辑,仅检查输入是否为空,减少对 EPLoginValidator 的依赖。 3. 更新错误处理方式,使用 showErrorToast 替代 showAlert,提升用户体验。 4. 在 EPLoginService 中直接使用字符串常量替代 grantType 变量,简化代码。 此更新旨在提升代码可读性和用户交互体验,确保登录流程更加流畅。
This commit is contained in:
@@ -15,7 +15,6 @@ import Foundation
|
||||
|
||||
private let clientSecret = EPLoginConfig.API.clientSecret
|
||||
private let clientId = EPLoginConfig.API.clientId
|
||||
private let grantType = EPLoginConfig.API.grantType
|
||||
private let version = EPLoginConfig.API.version
|
||||
|
||||
// MARK: - Private Helper Methods
|
||||
@@ -151,7 +150,7 @@ import Foundation
|
||||
client_secret: clientSecret,
|
||||
version: version,
|
||||
client_id: clientId,
|
||||
grant_type: grantType)
|
||||
grant_type: "password")
|
||||
}
|
||||
|
||||
/// 邮箱 + 验证码登录
|
||||
@@ -182,7 +181,7 @@ import Foundation
|
||||
client_secret: clientSecret,
|
||||
version: version,
|
||||
client_id: clientId,
|
||||
grant_type: grantType)
|
||||
grant_type: "email")
|
||||
}
|
||||
|
||||
/// 手机号 + 验证码登录
|
||||
@@ -215,7 +214,7 @@ import Foundation
|
||||
client_secret: clientSecret,
|
||||
version: version,
|
||||
client_id: clientId,
|
||||
grant_type: grantType,
|
||||
grant_type: "password",
|
||||
phoneAreaCode: areaCode)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user