Automatically dismiss the account detail view when the account is deleted.

This commit is contained in:
Maurice Parker 2019-09-08 10:04:36 -05:00
parent c4f7090b9c
commit ccaeeb8e6d
1 changed files with 6 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import Account
import RSWeb
struct SettingsDetailAccountView : View {
@Environment(\.presentationMode) var presentation
@ObservedObject var viewModel: ViewModel
@State private var isFeedbinCredentialsPresented = false
@State private var isDeleteAlertPresented = false
@ -55,8 +56,11 @@ struct SettingsDetailAccountView : View {
}
.alert(isPresented: $isDeleteAlertPresented) {
Alert(title: Text("Are you sure you want to delete \"\(viewModel.nameForDisplay)\"?"),
primaryButton: Alert.Button.default(Text("Delete"), action: { self.viewModel.delete() }),
secondaryButton: Alert.Button.cancel())
primaryButton: Alert.Button.default(Text("Delete"), action: {
self.viewModel.delete()
self.presentation.wrappedValue.dismiss()
}),
secondaryButton: Alert.Button.cancel())
}
}
}