diff --git a/app/src/main/java/com/example/citrusclient/viewmodels/SettingsViewModel.java b/app/src/main/java/com/example/citrusclient/viewmodels/SettingsViewModel.java index d9fe7f6..1fee00a 100644 --- a/app/src/main/java/com/example/citrusclient/viewmodels/SettingsViewModel.java +++ b/app/src/main/java/com/example/citrusclient/viewmodels/SettingsViewModel.java @@ -71,19 +71,29 @@ public void onResponse(Call call, Response response) { if (response.isSuccessful()) { System.out.println("success"); - error_changePw_LiveData.setValue(204); + error_changePw_LiveData.setValue(200); //成功処理 } else { System.out.println("fail"); - error_changePw_LiveData.setValue(404); + switch (response.code()){ + case 404: + //パスワードが違う + error_changePw_LiveData.setValue(404); + break; + case 403: + //認証失敗 + error_changePw_LiveData.setValue(403); + break; + } + } } @Override public void onFailure(Call call, Throwable t) { System.out.println("NetWorkError"+t); - error_changePw_LiveData.setValue(404); + error_changePw_LiveData.setValue(401); } }); } @@ -97,10 +107,10 @@ if(response.isSuccessful()){ System.out.println("success"); //成功処理 - error_deleteAccount_LiveData.setValue(204); + error_deleteAccount_LiveData.setValue(200); }else{ System.out.println("fail"); - //もしコンソール表記をするならこの下に処理を記載 + //パスワードが違う error_deleteAccount_LiveData.setValue(404); } } @@ -109,7 +119,7 @@ public void onFailure(Call call, Throwable t) { System.out.println("NetWorkError"+t); //もしコンソール表記をするならこの下に処理を記載 - error_deleteAccount_LiveData.setValue(404); + error_deleteAccount_LiveData.setValue(401); } }); } @@ -146,17 +156,27 @@ public void onResponse(Call call, Response response) { if(response.isSuccessful()){ System.out.println("success"); - error_changeAccount_LiveData.setValue(204); + error_changeAccount_LiveData.setValue(200); }else{ System.out.println("fail"); - error_changeAccount_LiveData.setValue(404); + switch (response.code()){ + case 404: + //ID・PWが違う + error_changeAccount_LiveData.setValue(404); + break; + case 403: + //承認失敗 + error_changeAccount_LiveData.setValue(403); + break; + } + } } @Override public void onFailure(Call call, Throwable t) { System.out.println("NetWorkError"+t); - error_changeAccount_LiveData.setValue(404); + error_changeAccount_LiveData.setValue(401); } }); }