LNHttpManager+Login.swift 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // LNHttpManager+Login.swift
  3. // Lanu
  4. //
  5. // Created by OneeChan on 2025/11/11.
  6. //
  7. import Foundation
  8. private let kNetPath_Login_Google = "/user/login/google/enter"
  9. private let kNetPath_Login_Email = "/user/login/email/enter"
  10. private let kNetPath_Login_Apple = "/user/login/apple/enter"
  11. private let kNetPath_Login_Refresh = "/user/renewalToken"
  12. private let kNetPath_Logout = "/user/logout"
  13. extension LNHttpManager {
  14. func loginByGoogle(token: String, completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) {
  15. post(path: kNetPath_Login_Google, params: ["data": token], completion: completion)
  16. }
  17. func loginByApple(token: String, completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) {
  18. post(path: kNetPath_Login_Apple, params: ["data": token], completion: completion)
  19. }
  20. #if DEBUG
  21. func loginByEmail(email: String, completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) {
  22. post(path: kNetPath_Login_Email, params: ["email": email], completion: completion)
  23. }
  24. #endif
  25. func refreshToken(completion: @escaping (LNRefreshTokenResponse?, LNHttpError?) -> Void) {
  26. post(path: kNetPath_Login_Refresh, completion: completion)
  27. }
  28. func logout(completion: @escaping (LNHttpError?) -> Void) {
  29. post(path: kNetPath_Logout, completion: completion)
  30. }
  31. }