Skip to content

Instantly share code, notes, and snippets.

@mariusk
Created August 25, 2015 11:06
Show Gist options
  • Save mariusk/63f3e6503200e92cae5b to your computer and use it in GitHub Desktop.
Save mariusk/63f3e6503200e92cae5b to your computer and use it in GitHub Desktop.
fun onClickLogin(@suppress("UNUSED_PARAMETER") v: View) {
Log.i(TAG, "onClickLogin "+email+" "+password+" "+Token.type+" "+Token.token);
Server.login(email, password, Token.type, Token.token)
.successUi { json ->
Log.i(TAG, "login successful, json: "+json.toString())
val user = json.getJSONObject("user")
AppState.auth.setUser(user.getInt("userid"),
user.getString("email"),
user.getString("name"))
Toast.makeText(this.getContext(),
"Login successful", Toast.LENGTH_LONG).show()
Log.i(TAG, "POST TOAST")
}
.failUi {
Toast.makeText(this.getContext(),
"Login failed!", Toast.LENGTH_LONG).show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment