diff --git a/AutoCat/ThirdParty/Api.swift b/AutoCat/ThirdParty/Api.swift index 887187e..5a7ded9 100644 --- a/AutoCat/ThirdParty/Api.swift +++ b/AutoCat/ThirdParty/Api.swift @@ -2,14 +2,12 @@ import Foundation import RxSwift class Api { - private static let baseUrl = "http://127.0.0.1:3000/" //"https://vps.aliencat.pro:8443/" - private static func genError(_ msg: String, suggestion: String, code: Int = 0) -> Error { return NSError(domain: "", code: code, userInfo: [NSLocalizedDescriptionKey: msg, NSLocalizedRecoverySuggestionErrorKey: suggestion]) } private static func createRequest(api: String, method: String, body: [String: T]? = nil) -> URLRequest? where T: LosslessStringConvertible { - guard var urlComponents = URLComponents(string: baseUrl + api) else { return nil } + guard var urlComponents = URLComponents(string: Constants.baseUrl + api) else { return nil } if let body = body, method.uppercased() == "GET" { urlComponents.queryItems = body.map { URLQueryItem(name: $0, value: String($1)) } diff --git a/AutoCat/Utils/Constants.swift b/AutoCat/Utils/Constants.swift index 86a21e5..b7e2ebb 100644 --- a/AutoCat/Utils/Constants.swift +++ b/AutoCat/Utils/Constants.swift @@ -1,6 +1,9 @@ import Foundation enum Constants { + static let baseUrl = "https://vps.aliencat.pro:8443/" + static let debugBaseUrl = "http://127.0.0.1:3000/" + static let googleAuthURL = "https://accounts.google.com/o/oauth2/v2/auth" static let googleTokenURL = "https://oauth2.googleapis.com/token" static let googleRedirectURL = "com.googleusercontent.apps.994679674451-k7clunkk4nicl6iuajdtc5u7hvustbdb:/oauth2callback"