Feature: use new update config api

This commit is contained in:
yicheng 2018-09-07 21:21:41 +08:00
parent 91ce828a56
commit 2e4b83693a

View File

@ -95,12 +95,19 @@ class ApiRequest{
}
static func requestConfigUpdate(callback:@escaping ((String?)->())){
if let errMSg = updateAllConfig() {
let err = String(cString: errMSg)
callback(err == "" ? nil : err)
} else {
callback("unknown error")
request(ConfigManager.apiUrl + "/configs", method: .put).responseJSON { (res) in
if res.response?.statusCode == 204 {
callback(nil)
} else {
if let errMSg = updateAllConfig() {
let err = String(cString: errMSg)
callback(err == "" ? nil : err)
} else {
callback("unknown error")
}
}
}
}