feat: api地址变更
This commit is contained in:
parent
8c4713d92e
commit
ea4a5617ec
@ -3,7 +3,7 @@ import Foundation
|
||||
/// API 配置信息
|
||||
public enum APIConfig {
|
||||
/// API 基础 URL
|
||||
public static let baseURL = "https://api.memorywake.com:31274/api/v1"
|
||||
public static let baseURL = "https://api.memorywake.com/api/v1"
|
||||
|
||||
/// 认证 token - 从 Keychain 中获取
|
||||
public static var authToken: String {
|
||||
|
||||
@ -11,7 +11,7 @@ import Foundation
|
||||
//enum AnyCodable: Codable {}
|
||||
|
||||
func passwordLogin(username: String, password: String) {
|
||||
guard let url = URL(string: "https://api.memorywake.com:31274/api/v1/iam/login/password-login") else {
|
||||
guard let url = URL(string: "https://api.memorywake.com/api/v1/iam/login/password-login") else {
|
||||
print("❌ 无效的URL")
|
||||
return
|
||||
}
|
||||
|
||||
@ -48,6 +48,19 @@ extension NetworkService: NetworkServiceProtocol {
|
||||
post(path: path, parameters: parameters, headers: headers, completion: completion)
|
||||
}
|
||||
|
||||
public func getWithToken<T: Decodable>(
|
||||
path: String,
|
||||
parameters: [String: Any]? = nil,
|
||||
completion: @escaping (Result<T, NetworkError>) -> Void
|
||||
) {
|
||||
var headers = [String: String]()
|
||||
if let token = KeychainHelper.getAccessToken() {
|
||||
headers["Authorization"] = "Bearer \(token)"
|
||||
}
|
||||
|
||||
get(path: path, parameters: parameters, headers: headers, completion: completion)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func upload(
|
||||
request: URLRequest,
|
||||
|
||||
@ -7,7 +7,7 @@ struct LoginResponse: Codable {
|
||||
|
||||
func callLoginAPI() {
|
||||
// 1. 创建 URL
|
||||
let urlString = "https://api.memorywake.com:31274/api/v1/iam/login/password-login"
|
||||
let urlString = "https://api.memorywake.com/api/v1/iam/login/password-login"
|
||||
guard let url = URL(string: urlString) else {
|
||||
print("Invalid URL")
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user