Commit aa0affb4 by Dima Bart

Show alert on error, prevent sending request if one is already in flight.

parent 5bc7179c
...@@ -85,6 +85,6 @@ extension AccountViewController: AuthenticationDelegate { ...@@ -85,6 +85,6 @@ extension AccountViewController: AuthenticationDelegate {
} }
func authenticationDidFailWithError(error: NSError?) { func authenticationDidFailWithError(error: NSError?) {
print("Failed to authenticate customer: \(error)") UIAlertView(title: "Error", message: error?.localizedDescription, delegate: nil, cancelButtonTitle: "OK").show()
} }
} }
\ No newline at end of file
...@@ -51,6 +51,8 @@ class LoginViewController: UITableViewController { ...@@ -51,6 +51,8 @@ class LoginViewController: UITableViewController {
// MARK: - Actions - // MARK: - Actions -
// //
private func loginUser() { private func loginUser() {
guard !self.actionCell.loading else { return }
let credentials = BUYAccountCredentials(items: [ let credentials = BUYAccountCredentials(items: [
BUYAccountCredentialItem(email: self.email), BUYAccountCredentialItem(email: self.email),
BUYAccountCredentialItem(password: self.password), BUYAccountCredentialItem(password: self.password),
......
...@@ -57,6 +57,8 @@ class SignupViewController: UITableViewController { ...@@ -57,6 +57,8 @@ class SignupViewController: UITableViewController {
// MARK: - Actions - // MARK: - Actions -
// //
private func createUser() { private func createUser() {
guard !self.actionCell.loading else { return }
let credentials = BUYAccountCredentials(items: [ let credentials = BUYAccountCredentials(items: [
BUYAccountCredentialItem(firstName: self.firstName), BUYAccountCredentialItem(firstName: self.firstName),
BUYAccountCredentialItem(lastName: self.lastName), BUYAccountCredentialItem(lastName: self.lastName),
......
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