This commit is contained in:
Татьяна Артамонова 2023-12-23 09:24:08 +04:00
parent 02b3e891a6
commit b1e844c956
2 changed files with 17 additions and 44 deletions

View File

@ -59,33 +59,6 @@ class RestFlightRepository(
override suspend fun getFlightById(flightId: Int): Flight =
service.getFlight(flightId).toFlight()
// override suspend fun findFlights(
// from: String,
// to: String,
// departureDate: String
// ): List<Flight> = suspendCancellableCoroutine { continuation ->
// val call = service.findFlights(from, to, departureDate)
// call.enqueue(object: Callback<List<FlightRemote>> {
// override fun onResponse(call: Call<List<FlightRemote>>, response: Response<List<FlightRemote>>) {
// if (response.isSuccessful) {
// val flightRemoteList = response.body() ?: emptyList()
// val flightList = flightRemoteList.map { it.toFlight() }
// continuation.resume(flightList)
// } else {
// continuation.resumeWithException(Exception("Server error: ${response.code()}"))
// }
// }
//
// override fun onFailure(call: Call<List<FlightRemote>>, t: Throwable) {
// continuation.resumeWithException(t)
// }
// })
//
// continuation.invokeOnCancellation {
// call.cancel()
// }
// }
override suspend fun findFlights(
from: String,
to: String,

View File

@ -45,23 +45,6 @@ fun Admin (
) {
Text("Рейсы")
}
Button(
onClick = { navController.navigate(BottomBarScreen.RentList.route)},
colors = ButtonDefaults.buttonColors(
containerColor = (colorResource(id = R.color.lightBlue)),
contentColor = Color.White
),
elevation = ButtonDefaults.buttonElevation(
defaultElevation = 10.dp,
pressedElevation = 6.dp
),
shape = RoundedCornerShape(15.dp),
modifier = Modifier
.fillMaxWidth()
.padding(all = 10.dp),
) {
Text("Бронирования")
}
Button(
onClick = { navController.navigate(BottomBarScreen.UserList.route)},
colors = ButtonDefaults.buttonColors(
@ -79,5 +62,22 @@ fun Admin (
) {
Text("Пользователи")
}
Button(
onClick = { navController.navigate(BottomBarScreen.RentList.route)},
colors = ButtonDefaults.buttonColors(
containerColor = (colorResource(id = R.color.lightBlue)),
contentColor = Color.White
),
elevation = ButtonDefaults.buttonElevation(
defaultElevation = 10.dp,
pressedElevation = 6.dp
),
shape = RoundedCornerShape(15.dp),
modifier = Modifier
.fillMaxWidth()
.padding(all = 10.dp),
) {
Text("Бронирования")
}
}
}