diff --git a/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/frontend/features/veranstalter/data/remote/DefaultVeranstalterRepository.kt b/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/frontend/features/veranstalter/data/remote/DefaultVeranstalterRepository.kt index aa9390cc..fb8494a3 100644 --- a/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/frontend/features/veranstalter/data/remote/DefaultVeranstalterRepository.kt +++ b/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/frontend/features/veranstalter/data/remote/DefaultVeranstalterRepository.kt @@ -19,9 +19,9 @@ class DefaultVeranstalterRepository( val response = client.get(ApiRoutes.Veranstalter.ROOT) when { response.status.isSuccess() -> response.body>().map { it.toDomain() } - response.status == HttpStatusCode.Unauthorized -> throw AuthExpired - response.status == HttpStatusCode.Forbidden -> throw AuthForbidden - response.status.value >= 500 -> throw ServerError + response.status == HttpStatusCode.Unauthorized -> throw AuthExpired() + response.status == HttpStatusCode.Forbidden -> throw AuthForbidden() + response.status.value >= 500 -> throw ServerError() else -> throw HttpError(response.status.value) } } @@ -30,10 +30,10 @@ class DefaultVeranstalterRepository( val response = client.get("${ApiRoutes.Veranstalter.ROOT}/$id") when { response.status.isSuccess() -> response.body().toDomain() - response.status == HttpStatusCode.NotFound -> throw NotFound - response.status == HttpStatusCode.Unauthorized -> throw AuthExpired - response.status == HttpStatusCode.Forbidden -> throw AuthForbidden - response.status.value >= 500 -> throw ServerError + response.status == HttpStatusCode.NotFound -> throw NotFound() + response.status == HttpStatusCode.Unauthorized -> throw AuthExpired() + response.status == HttpStatusCode.Forbidden -> throw AuthForbidden() + response.status.value >= 500 -> throw ServerError() else -> throw HttpError(response.status.value) } } @@ -42,8 +42,8 @@ class DefaultVeranstalterRepository( val response = client.post(ApiRoutes.Veranstalter.ROOT) { setBody(model.toDto()) } when { response.status.isSuccess() -> response.body().toDomain() - response.status == HttpStatusCode.Conflict -> throw Conflict - response.status.value >= 500 -> throw ServerError + response.status == HttpStatusCode.Conflict -> throw Conflict() + response.status.value >= 500 -> throw ServerError() else -> throw HttpError(response.status.value) } } @@ -52,9 +52,9 @@ class DefaultVeranstalterRepository( val response = client.put("${ApiRoutes.Veranstalter.ROOT}/$id") { setBody(model.toDto()) } when { response.status.isSuccess() -> response.body().toDomain() - response.status == HttpStatusCode.NotFound -> throw NotFound - response.status == HttpStatusCode.Conflict -> throw Conflict - response.status.value >= 500 -> throw ServerError + response.status == HttpStatusCode.NotFound -> throw NotFound() + response.status == HttpStatusCode.Conflict -> throw Conflict() + response.status.value >= 500 -> throw ServerError() else -> throw HttpError(response.status.value) } } @@ -63,17 +63,17 @@ class DefaultVeranstalterRepository( val response = client.delete("${ApiRoutes.Veranstalter.ROOT}/$id") when { response.status.isSuccess() -> Unit - response.status == HttpStatusCode.NotFound -> throw NotFound - response.status.value >= 500 -> throw ServerError + response.status == HttpStatusCode.NotFound -> throw NotFound() + response.status.value >= 500 -> throw ServerError() else -> throw HttpError(response.status.value) } } } // Fehler-Typen (vereinfachtes DomainError-Äquivalent) -object AuthExpired : RuntimeException("AUTH_EXPIRED") -object AuthForbidden : RuntimeException("AUTH_FORBIDDEN") -object NotFound : RuntimeException("NOT_FOUND") -object Conflict : RuntimeException("CONFLICT") -object ServerError : RuntimeException("SERVER_ERROR") +class AuthExpired : RuntimeException("AUTH_EXPIRED") +class AuthForbidden : RuntimeException("AUTH_FORBIDDEN") +class NotFound : RuntimeException("NOT_FOUND") +class Conflict : RuntimeException("CONFLICT") +class ServerError : RuntimeException("SERVER_ERROR") class HttpError(val code: Int) : RuntimeException("HTTP_$code") diff --git a/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/frontend/features/veranstalter/di/VeranstalterModule.kt b/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/frontend/features/veranstalter/di/VeranstalterModule.kt index e3c0a838..be011113 100644 --- a/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/frontend/features/veranstalter/di/VeranstalterModule.kt +++ b/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/frontend/features/veranstalter/di/VeranstalterModule.kt @@ -2,7 +2,6 @@ package at.mocode.frontend.features.veranstalter.di import at.mocode.frontend.features.veranstalter.data.remote.DefaultVeranstalterRepository import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository -import io.ktor.client.HttpClient import org.koin.core.qualifier.named import org.koin.dsl.module diff --git a/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/veranstalter/feature/presentation/VeranstalterAuswahlV2.kt b/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/veranstalter/feature/presentation/VeranstalterAuswahlV2.kt index a7521128..938f6d5a 100644 --- a/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/veranstalter/feature/presentation/VeranstalterAuswahlV2.kt +++ b/frontend/features/veranstalter-feature/src/jvmMain/kotlin/at/mocode/veranstalter/feature/presentation/VeranstalterAuswahlV2.kt @@ -9,7 +9,6 @@ import androidx.compose.foundation.lazy.items import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowForward import androidx.compose.material.icons.filled.Add -import androidx.compose.material.icons.filled.ArrowForward import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Search import androidx.compose.material3.*