feat: 删除接口
This commit is contained in:
parent
aa954ddfb9
commit
2caf82318a
@ -491,6 +491,10 @@ class NetworkService {
|
||||
headers: [String: String]? = nil,
|
||||
completion: @escaping (Result<T, NetworkError>) -> Void
|
||||
) {
|
||||
var headers = headers ?? [:]
|
||||
if let token = KeychainHelper.getAccessToken() {
|
||||
headers["Authorization"] = "Bearer \(token)"
|
||||
}
|
||||
request("DELETE", path: path, parameters: parameters, headers: headers, completion: completion)
|
||||
}
|
||||
|
||||
|
||||
@ -106,10 +106,19 @@ struct AccountView: View {
|
||||
|
||||
Button(action: {
|
||||
// 处理删除账号逻辑
|
||||
NetworkService.shared.delete(path: "/iam/delete-user", parameters: nil) { result in
|
||||
switch result {
|
||||
case .success(let data):
|
||||
print("删除账号成功: \(data)")
|
||||
case .failure(let error):
|
||||
print("删除账号失败: \(error)")
|
||||
}
|
||||
}
|
||||
// 关闭弹窗
|
||||
withAnimation {
|
||||
showDeleteConfirmation = false
|
||||
}
|
||||
// TODO: 调用删除账号的API
|
||||
|
||||
}) {
|
||||
Text("Confirm")
|
||||
.foregroundColor(.themeTextMessage)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user