diff --git a/server/src/main/kotlin/application/rooms.kt b/server/src/main/kotlin/application/rooms.kt index 153d4d6..44c4a0b 100644 --- a/server/src/main/kotlin/application/rooms.kt +++ b/server/src/main/kotlin/application/rooms.kt @@ -4,6 +4,7 @@ import application.configuration.getPlayer import io.ktor.http.* import io.ktor.server.application.* import io.ktor.server.auth.* +import io.ktor.server.request.* import io.ktor.server.response.* import io.ktor.server.routing.* import kotlinx.uuid.UUID @@ -17,14 +18,11 @@ fun Application.configureRooms() { route("rooms") { post { call.respond(listRoom()) } post("create") { call.respond(createRoom(call.getPlayer())) } - post("join/{uuid}") { - call.parameters["uuid"] + post("join") { //todo call.respond(HttpStatusCode.OK) } - post("{uuid}/name") { - call.respond(nameRoom(UUID(call.parameters["uuid"]!!))) - } + post("name") { call.respond(nameRoom(call.receive())) } } } } diff --git a/shared/src/commonMain/kotlin/network/ViewedRoom.kt b/shared/src/commonMain/kotlin/network/ViewedRoom.kt index 0066bee..b9fdd4e 100644 --- a/shared/src/commonMain/kotlin/network/ViewedRoom.kt +++ b/shared/src/commonMain/kotlin/network/ViewedRoom.kt @@ -22,6 +22,6 @@ suspend fun getViewedRooms() = runCatching { }.body>() }.apply { this.exceptionOrNull()?.printStackTrace() }.getOrElse { listOf() } -suspend fun joinRoom(uuid: UUID) = sendHttp("rooms/join/$uuid").status +suspend fun joinRoom(uuid: UUID) = sendHttp("rooms/join", uuid).status -suspend fun getRoomName(uuid: UUID) = sendHttp("rooms/$uuid/name").body() \ No newline at end of file +suspend fun getRoomName(uuid: UUID) = sendHttp("rooms/name", uuid).body() \ No newline at end of file