From a17736db9d7c6c6be6db1d86c68faa4596ef1952 Mon Sep 17 00:00:00 2001 From: "Gleb O. Ivaniczkij" Date: Wed, 28 Aug 2024 21:17:36 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20URLBuilder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../csasq/cit_is_bot/ui/dialogs/ScenarioDialog.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/dialogs/ScenarioDialog.kt b/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/dialogs/ScenarioDialog.kt index 9760b88..ad14623 100644 --- a/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/dialogs/ScenarioDialog.kt +++ b/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/dialogs/ScenarioDialog.kt @@ -61,6 +61,8 @@ import io.ktor.client.request.put import io.ktor.client.request.setBody import io.ktor.http.ContentType import io.ktor.http.HttpStatusCode +import io.ktor.http.URLBuilder +import io.ktor.http.URLProtocol import io.ktor.http.contentType import kotlinx.coroutines.launch import org.jetbrains.compose.resources.DrawableResource @@ -153,7 +155,16 @@ fun ScenarioDialog( scenarioDialogState.value?.name = nameState.value!! coroutine.launch { progressIndicatorState.value = true - val response = client.put("https://cit.csasq.ru/api/scripts") { + val url = URLBuilder( + protocol = URLProtocol.HTTPS, + host = "cit.csasq.ru", + pathSegments = listOf( + "api", + "scripts", + scenarioDialogState.value!!.id.toString(), + ) + ) + val response = client.put(url.build()) { contentType(ContentType.Application.Json) setBody(scenarioDialogState.value) }