PWD-7: check for empty values before creation
This commit is contained in:
parent
737d904807
commit
083ca1f030
1 changed files with 10 additions and 0 deletions
|
@ -37,6 +37,16 @@ struct AddPasswordView: View {
|
||||||
.font(.footnote)
|
.font(.footnote)
|
||||||
HStack {
|
HStack {
|
||||||
PwdButton(label: Text("Save")) {
|
PwdButton(label: Text("Save")) {
|
||||||
|
|
||||||
|
if name.isEmpty || value.isEmpty {
|
||||||
|
let alert = NSAlert()
|
||||||
|
alert.messageText = "Missing values"
|
||||||
|
alert.informativeText = "Make sure to fill in both name and value!"
|
||||||
|
alert.addButton(withTitle: "Okay")
|
||||||
|
alert.runModal()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
viewModel.createPassword(name: name, value: value)
|
viewModel.createPassword(name: name, value: value)
|
||||||
name = ""
|
name = ""
|
||||||
value = ""
|
value = ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue