Commit 94cde519 by Dima Bart

Clear textfields on successful login or signup.

parent 623fb96a
......@@ -58,10 +58,18 @@ class LoginViewController: UITableViewController {
BUYClient.sharedClient.loginCustomerWithCredentials(credentials) { (customer, token, error) in
self.actionCell.loading = false
if let _ = customer {
self.clear()
}
print("Customer: \(customer), Token: \(token), Error: \(error)")
}
}
private func clear() {
self.emailField.text = ""
self.passwordField.text = ""
}
// ----------------------------------
// MARK: - UITableViewDelegate -
//
......
......@@ -40,7 +40,7 @@ class SignupViewController: UITableViewController {
var lastName: String { return self.lastNameField.text ?? "" }
var email: String { return self.emailField.text ?? "" }
var password: String { return self.passwordField.text ?? "" }
var passwordConfirm: String { return self.passwordField.text ?? "" }
var passwordConfirm: String { return self.passwordConfirmField.text ?? "" }
// ----------------------------------
// MARK: - View Loading -
......@@ -67,10 +67,21 @@ class SignupViewController: UITableViewController {
BUYClient.sharedClient.createCustomerWithCredentials(credentials) { (customer, token, error) in
self.actionCell.loading = false
if let _ = customer {
self.clear()
}
print("Customer: \(customer), Token: \(token), Error: \(error)")
}
}
private func clear() {
self.firstNameField.text = ""
self.lastNameField.text = ""
self.emailField.text = ""
self.passwordField.text = ""
self.passwordConfirmField.text = ""
}
// ----------------------------------
// MARK: - UITableViewDelegate -
//
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment