| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- //
- // LNHttpManager+Login.swift
- // Lanu
- //
- // Created by OneeChan on 2025/11/11.
- //
- import Foundation
- private let kNetPath_Login_Google = "/user/login/google/enter"
- private let kNetPath_Login_Email = "/user/login/email/enter"
- private let kNetPath_Login_Apple = "/user/login/apple/enter"
- private let kNetPath_Login_Phone = "/user/login/mobile/enter"
- private let kNetPath_Login_Refresh = "/user/renewalToken"
- private let kNetPath_Logout = "/user/logout"
- private let kNetPath_Login_Captcha = "/user/login/mobile/sendCode"
- extension LNHttpManager {
- func loginByPhone(code: String, num: String, captcha: String,
- completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) {
- post(path: kNetPath_Login_Phone, params: [
- "mobile": [
- "code": code,
- "num": num
- ],
- "code": captcha
- ], completion: completion)
- }
-
- func loginByApple(token: String, completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) {
- post(path: kNetPath_Login_Apple, params: ["data": token], completion: completion)
- }
-
- func loginByGoogle(token: String, completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) {
- post(path: kNetPath_Login_Google, params: ["data": token], completion: completion)
- }
-
- #if DEBUG
- func loginByEmail(email: String, completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) {
- post(path: kNetPath_Login_Email, params: ["email": email], completion: completion)
- }
- #endif
-
- func refreshToken(completion: @escaping (LNRefreshTokenResponse?, LNHttpError?) -> Void) {
- post(path: kNetPath_Login_Refresh, completion: completion)
- }
-
- func logout(completion: @escaping (LNHttpError?) -> Void) {
- post(path: kNetPath_Logout, completion: completion)
- }
- }
- extension LNHttpManager {
- func getLoginCaptcha(code: String, phone: String, completion: @escaping (LNHttpError?) -> Void) {
- post(path: kNetPath_Login_Captcha, params: [
- "code": code,
- "num": phone
- ], completion: completion)
- }
- }
|