simpliest version of content upload
This commit is contained in:
@@ -48,7 +48,7 @@ class ClientWritePostsService(
|
||||
removeRoute
|
||||
)
|
||||
private val tempUploadFullPath = buildStandardUrl(
|
||||
baseUrl,
|
||||
root,
|
||||
postsCreateTempPathPart
|
||||
)
|
||||
|
||||
@@ -60,6 +60,7 @@ class ClientWritePostsService(
|
||||
tempUploadFullPath,
|
||||
provider.file
|
||||
)
|
||||
println(fileId)
|
||||
it.copy(inputProvider = TempFileIdentifierInputProvider(fileId))
|
||||
}
|
||||
is TempFileIdentifierInputProvider -> it
|
||||
|
@@ -0,0 +1,15 @@
|
||||
package dev.inmo.postssystem.services.posts.client.ui.create
|
||||
|
||||
import dev.inmo.postssystem.features.common.common.*
|
||||
import dev.inmo.postssystem.features.content.common.Content
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
class PostCreateUIViewModel(
|
||||
private val model: PostCreateUIModel
|
||||
) : UIViewModel<PostCreateUIState> {
|
||||
override val currentState: StateFlow<PostCreateUIState>
|
||||
get() = model.currentState
|
||||
suspend fun create(content: List<Content>) {
|
||||
model.create(content)
|
||||
}
|
||||
}
|
@@ -3,9 +3,8 @@ package dev.inmo.postssystem.services.posts.client
|
||||
import dev.inmo.micro_utils.common.MPPFile
|
||||
import dev.inmo.micro_utils.ktor.client.UnifiedRequester
|
||||
import dev.inmo.postssystem.features.files.common.FileId
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.GlobalScope.coroutineContext
|
||||
import kotlinx.coroutines.job
|
||||
import org.w3c.xhr.*
|
||||
|
||||
internal actual suspend fun UnifiedRequester.tempUpload(
|
||||
@@ -39,7 +38,7 @@ internal actual suspend fun UnifiedRequester.tempUpload(
|
||||
request.open("POST", fullTempUploadDraftPath, true)
|
||||
request.send(formData)
|
||||
|
||||
coroutineContext.job.invokeOnCompletion {
|
||||
currentCoroutineContext().job.invokeOnCompletion {
|
||||
runCatching {
|
||||
request.abort()
|
||||
}
|
||||
|
Reference in New Issue
Block a user