From 6aad1c3cb0b7e6905953f3a97b6da083a98a4a37 Mon Sep 17 00:00:00 2001 From: Alex Sokol / y9san9 Date: Wed, 1 Nov 2023 08:56:25 +0300 Subject: [PATCH] fix: serializers fix --- .../kotlin/app/meetacy/sdk/engine/ktor/response/Response.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/response/Response.kt b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/response/Response.kt index bcc6a05a..7a299abb 100644 --- a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/response/Response.kt +++ b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/response/Response.kt @@ -11,13 +11,12 @@ import kotlinx.serialization.json.Json @Serializable(with = ServerResponse.Serializer::class) internal sealed interface ServerResponse { - @Serializable + data class Error( val errorCode: Int, val errorMessage: String ) : ServerResponse - @Serializable data class Success(val result: T) : ServerResponse @Suppress("UNCHECKED_CAST") @@ -64,5 +63,5 @@ internal fun Payload.decodeToServerResponse( } internal suspend inline fun HttpResponse.bodyAsSuccess(): T { - return body>().result + return (body>() as ServerResponse.Success).result }