#49 Fix issue with not connected actions to buttons
This commit is contained in:
parent
6651e53700
commit
9653ac2b29
|
@ -87,12 +87,18 @@ struct FollowRequestsView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.swipeActions {
|
.swipeActions {
|
||||||
Button {
|
Button(role: .destructive) {
|
||||||
|
Task {
|
||||||
|
await self.approve(account: account)
|
||||||
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Label("followingRequests.title.approve", systemImage: "checkmark")
|
Label("followingRequests.title.approve", systemImage: "checkmark")
|
||||||
}
|
}
|
||||||
|
|
||||||
Button(role: .destructive) {
|
Button(role: .destructive) {
|
||||||
|
Task {
|
||||||
|
await self.reject(account: account)
|
||||||
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Label("followingRequests.title.reject", systemImage: "xmark")
|
Label("followingRequests.title.reject", systemImage: "xmark")
|
||||||
}
|
}
|
||||||
|
@ -156,6 +162,7 @@ struct FollowRequestsView: View {
|
||||||
private func approve(account: Account) async {
|
private func approve(account: Account) async {
|
||||||
do {
|
do {
|
||||||
_ = try await self.client.followRequests?.authorizeRequest(id: account.id)
|
_ = try await self.client.followRequests?.authorizeRequest(id: account.id)
|
||||||
|
self.accounts.removeAll { $0.id == account.id }
|
||||||
} catch {
|
} catch {
|
||||||
ErrorService.shared.handle(error, message: "followingRequests.error.approve", showToastr: true)
|
ErrorService.shared.handle(error, message: "followingRequests.error.approve", showToastr: true)
|
||||||
}
|
}
|
||||||
|
@ -164,6 +171,7 @@ struct FollowRequestsView: View {
|
||||||
private func reject(account: Account) async {
|
private func reject(account: Account) async {
|
||||||
do {
|
do {
|
||||||
_ = try await self.client.followRequests?.rejectRequest(id: account.id)
|
_ = try await self.client.followRequests?.rejectRequest(id: account.id)
|
||||||
|
self.accounts.removeAll { $0.id == account.id }
|
||||||
} catch {
|
} catch {
|
||||||
ErrorService.shared.handle(error, message: "followingRequests.error.reject", showToastr: true)
|
ErrorService.shared.handle(error, message: "followingRequests.error.reject", showToastr: true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue