-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat/#63] confirmDialog ViewModel 생성
- Loading branch information
Showing
3 changed files
with
22 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 15 additions & 3 deletions
18
...main/java/com/sopt/umbba_android/presentation/qna/ConfirmAnswerDialogFragmentViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
package com.sopt.umbba_android.presentation.qna | ||
|
||
import android.util.Log | ||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.sopt.umbba_android.data.model.request.AnswerRequestDto | ||
import com.sopt.umbba_android.data.repository.QuestionAnswerRepositoryImpl | ||
import kotlinx.coroutines.launch | ||
|
||
class ConfirmAnswerDialogFragmentViewModel : ViewModel() { | ||
fun postAnswer(answer: String) { | ||
//TODO(post Repo로 가는 함수 가보자고.) | ||
class ConfirmAnswerDialogFragmentViewModel(private val questionAnswerRepositoryImpl: QuestionAnswerRepositoryImpl) : ViewModel() { | ||
fun postAnswer(answerRequestDto: AnswerRequestDto) { | ||
viewModelScope.launch { | ||
questionAnswerRepositoryImpl.postAnswer(answerRequestDto) | ||
.onSuccess { | ||
Log.e("hyeon", "postAnswer 성공") | ||
}.onFailure { error -> | ||
Log.e("hyeon", "postAnswer 실패 " + error.message) | ||
} | ||
} | ||
} | ||
} |