fix register issue
This commit is contained in:
parent
15fce6daa2
commit
90dfd2b2d3
1 changed files with 6 additions and 3 deletions
|
@ -132,6 +132,7 @@ public class RegisterActivity extends AppCompatActivity {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d(TAG, e.toString());
|
Log.d(TAG, e.toString());
|
||||||
}
|
}
|
||||||
|
Log.d(TAG,"JSON: "+tempJson.toString());
|
||||||
|
|
||||||
VolleyUtilSingleton.getInstance(RegisterActivity.this).post(BASE_URL + REG_PATH, tempJson, onRegisterSuccess, onRegisterError);
|
VolleyUtilSingleton.getInstance(RegisterActivity.this).post(BASE_URL + REG_PATH, tempJson, onRegisterSuccess, onRegisterError);
|
||||||
} else {
|
} else {
|
||||||
|
@ -143,9 +144,11 @@ public class RegisterActivity extends AppCompatActivity {
|
||||||
Response.Listener<JSONObject> onRegisterSuccess = new Response.Listener<JSONObject>() {
|
Response.Listener<JSONObject> onRegisterSuccess = new Response.Listener<JSONObject>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONObject response) {
|
||||||
|
Log.d(TAG,"reposne: "+ response.toString());
|
||||||
try {
|
try {
|
||||||
if(!response.isNull("user")) {
|
if(response.getString("message").equals("created")) {
|
||||||
Log.e(TAG, "onLoginSuccess => user exist"); // TODO: REMOVE console
|
|
||||||
|
Log.d(TAG, "onRegisterSuccess => user created"); // TODO: REMOVE console
|
||||||
Intent loginActivity = new Intent(RegisterActivity.this, LoginActivity.class);
|
Intent loginActivity = new Intent(RegisterActivity.this, LoginActivity.class);
|
||||||
// Bundle loginUserBundle = new Bundle();
|
// Bundle loginUserBundle = new Bundle();
|
||||||
// loginUserBundle.putString("user_id", response.getJSONObject("user").getString("id"));
|
// loginUserBundle.putString("user_id", response.getJSONObject("user").getString("id"));
|
||||||
|
@ -153,7 +156,7 @@ public class RegisterActivity extends AppCompatActivity {
|
||||||
startActivity(loginActivity);
|
startActivity(loginActivity);
|
||||||
} else {
|
} else {
|
||||||
// showProgress(false);
|
// showProgress(false);
|
||||||
Log.d(TAG, "Cannot create user, " + response.get("user"));
|
Log.d(TAG, "Cannot create user, " + response.getString("message"));
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
Log.e(TAG, "onRegisterSuccess:" + e.getMessage());
|
Log.e(TAG, "onRegisterSuccess:" + e.getMessage());
|
||||||
|
|
Loading…
Reference in a new issue