Handle enter button on login/registration
This commit is contained in:
parent
d22b1defc8
commit
e23b6db257
2 changed files with 15 additions and 0 deletions
|
@ -44,6 +44,11 @@ struct LoginView: View {
|
||||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
.textContentType(UITextContentType.password)
|
.textContentType(UITextContentType.password)
|
||||||
.textContentType(.password)
|
.textContentType(.password)
|
||||||
|
.onSubmit {
|
||||||
|
Task {
|
||||||
|
await self.dataStore.login(username: self.username, password: self.password)
|
||||||
|
}
|
||||||
|
}
|
||||||
Button("action_login", action: {
|
Button("action_login", action: {
|
||||||
Task {
|
Task {
|
||||||
await self.dataStore.login(username: self.username, password: self.password)
|
await self.dataStore.login(username: self.username, password: self.password)
|
||||||
|
|
|
@ -34,6 +34,16 @@ struct RegistrationView: View {
|
||||||
SecureField("prompt_confirm_password", text: self.$confirmedPassword)
|
SecureField("prompt_confirm_password", text: self.$confirmedPassword)
|
||||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
.textContentType(UITextContentType.newPassword)
|
.textContentType(UITextContentType.newPassword)
|
||||||
|
.onSubmit {
|
||||||
|
Task {
|
||||||
|
await self.dataStore.register(
|
||||||
|
username: self.username,
|
||||||
|
email: self.email,
|
||||||
|
password: self.password,
|
||||||
|
confirmPassword: self.confirmedPassword
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
Button("action_register", action: {
|
Button("action_register", action: {
|
||||||
Task {
|
Task {
|
||||||
await self.dataStore.register(
|
await self.dataStore.register(
|
||||||
|
|
Loading…
Reference in a new issue