File tree Expand file tree Collapse file tree
app/src/main/java/com/runnect/runnect/presentation/draw Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import com.runnect.runnect.presentation.state.UiState
1313import com.runnect.runnect.util.extension.collectResult
1414import com.runnect.runnect.util.multipart.ContentUriRequestBody
1515import dagger.hilt.android.lifecycle.HiltViewModel
16- import kotlinx.coroutines.flow.onStart
1716import timber.log.Timber
1817import javax.inject.Inject
1918import kotlin.math.acos
@@ -85,6 +84,7 @@ class DrawViewModel @Inject constructor(
8584 }
8685
8786 fun uploadCourse () {
87+ _drawState .value = UiState .Loading
8888 launchWithHandler {
8989 courseRepository.uploadCourse(
9090 image = _image .value!! .toFormData(),
@@ -95,9 +95,7 @@ class DrawViewModel @Inject constructor(
9595 departureAddress = departureAddress,
9696 departureName = departureName
9797 ).toRequestBody()
98- ).onStart {
99- _drawState .value = UiState .Loading
100- }.collectResult(
98+ ).collectResult(
10199 onSuccess = {
102100 uploadCourseId = it
103101 _drawState .value = UiState .Success
You can’t perform that action at this time.
0 commit comments