Skip to content

Commit

Permalink
refactor: 코틀린 컨벤션에 맞게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
nueijeel committed Jan 3, 2024
1 parent d91032a commit a4dc9be
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,28 @@ class HomeRepositoryImpl
}
}

override suspend fun postDogWeight(
accessToken: String,
weightRequest: WeightPostRequest
): Int? {
try {
val response = homeRetrofitClient.homeApi.postDogWeight(accessToken, weightRequest)
if (response.code() == 200) {
Log.d("HomeRepo-PostDogWeight", "통신 성공 : ${response.code()}")
return response.code()
} else {
Log.d("HomeRepo-PostDogWeight", "통신 실패 : ${response.code()}")
val stringToJson = JSONObject(response.errorBody()?.string()!!)
Log.d("HomeRepo-PostDogWeight", "$stringToJson")
return response.code()
override suspend fun postDogWeight(
accessToken: String,
weightRequest: WeightPostRequest
): Int? {
try {
val response = homeRetrofitClient.homeApi.postDogWeight(accessToken, weightRequest)
if (response.code() == 200) {
Log.d("HomeRepo-PostDogWeight", "통신 성공 : ${response.code()}")
return response.code()
} else {
Log.d("HomeRepo-PostDogWeight", "통신 실패 : ${response.code()}")
val stringToJson = JSONObject(response.errorBody()?.string()!!)
Log.d("HomeRepo-PostDogWeight", "$stringToJson")
return response.code()
}
} catch (e: Exception) {
e.printStackTrace()
return null
}
} catch (e: Exception) {
e.printStackTrace()
return null
}
}

override suspend fun getDogWeight(

override suspend fun getDogWeight(
dogId: Long,
date: String,
accessToken: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ class HomeFragment : Fragment(), DateSubmitListener, DogProfileClickListener, Ho

homeViewModel.homeDogWeightPost.observe(viewLifecycleOwner) { responseCode ->
if (responseCode != null && responseCode == 200) {
homeViewModel.getDogWeight(homeViewModel.homeSelectedDogId.value!!, dateToString(homeViewModel.homeSelectedDate.value!!), currentAccessToken)
homeViewModel.getDogWeight(
homeViewModel.homeSelectedDogId.value!!,
dateToString(homeViewModel.homeSelectedDate.value!!),
currentAccessToken,
)
}
}

Expand Down

0 comments on commit a4dc9be

Please sign in to comment.