Skip to content

Commit

Permalink
fix : baseResponse로 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Amepistheo committed Feb 22, 2024
1 parent 13dbdd1 commit 7a1c0ae
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.eatssu.android.data.model.response.BaseResponse
import com.eatssu.android.data.service.ReviewService
import com.eatssu.android.util.RetrofitImpl
import com.eatssu.android.util.RetrofitImpl.retrofit
Expand Down Expand Up @@ -37,8 +38,8 @@ class FixViewModel : ViewModel() {
""".trimIndent().toRequestBody("application/json".toMediaTypeOrNull())

viewModelScope.launch(Dispatchers.IO) {
service.modifyReview(reviewId, reviewData).enqueue(object : Callback<Void> {
override fun onResponse(call: Call<Void>, response: Response<Void>) {
service.modifyReview(reviewId, reviewData).enqueue(object : Callback<BaseResponse<Void>> {
override fun onResponse(call: Call<BaseResponse<Void>>, response: Response<BaseResponse<Void>>) {
if (response.isSuccessful) {
if (response.code() == 200) {
handleSuccessResponse("수정이 완료되었습니다.")
Expand All @@ -48,7 +49,7 @@ class FixViewModel : ViewModel() {
}
}

override fun onFailure(call: Call<Void>, t: Throwable) {
override fun onFailure(call: Call<BaseResponse<Void>>, t: Throwable) {
handleErrorResponse("수정이 실패하였습니다.")
}
})
Expand Down

0 comments on commit 7a1c0ae

Please sign in to comment.