From 90dfd2b2d36282fa85adbd732825eea45299c8bb Mon Sep 17 00:00:00 2001 From: Aran Zaiger Date: Mon, 4 Jul 2016 23:10:54 +0300 Subject: [PATCH] fix register issue --- .../ara/sagi/thesocialnotework/RegisterActivity.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/RegisterActivity.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/RegisterActivity.java index 337cd92..5391099 100644 --- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/RegisterActivity.java +++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/RegisterActivity.java @@ -132,6 +132,7 @@ public class RegisterActivity extends AppCompatActivity { } catch (Exception e) { Log.d(TAG, e.toString()); } + Log.d(TAG,"JSON: "+tempJson.toString()); VolleyUtilSingleton.getInstance(RegisterActivity.this).post(BASE_URL + REG_PATH, tempJson, onRegisterSuccess, onRegisterError); } else { @@ -143,9 +144,11 @@ public class RegisterActivity extends AppCompatActivity { Response.Listener onRegisterSuccess = new Response.Listener() { @Override public void onResponse(JSONObject response) { + Log.d(TAG,"reposne: "+ response.toString()); try { - if(!response.isNull("user")) { - Log.e(TAG, "onLoginSuccess => user exist"); // TODO: REMOVE console + if(response.getString("message").equals("created")) { + + Log.d(TAG, "onRegisterSuccess => user created"); // TODO: REMOVE console Intent loginActivity = new Intent(RegisterActivity.this, LoginActivity.class); // Bundle loginUserBundle = new Bundle(); // loginUserBundle.putString("user_id", response.getJSONObject("user").getString("id")); @@ -153,7 +156,7 @@ public class RegisterActivity extends AppCompatActivity { startActivity(loginActivity); } else { // showProgress(false); - Log.d(TAG, "Cannot create user, " + response.get("user")); + Log.d(TAG, "Cannot create user, " + response.getString("message")); } }catch (Exception e) { Log.e(TAG, "onRegisterSuccess:" + e.getMessage());