Handle case when message details response body is null
This commit is contained in:
parent
b4941cb70a
commit
44c31fa0d5
2 changed files with 2 additions and 2 deletions
|
@ -88,7 +88,7 @@ internal class MessagesRepository(
|
|||
}
|
||||
|
||||
suspend fun getMessageDetails(globalKey: String, markAsRead: Boolean): MessageDetails {
|
||||
val details = api.getMessageDetails(globalKey)
|
||||
val details = api.getMessageDetails(globalKey) ?: error("Message not exist")
|
||||
if (markAsRead) {
|
||||
runCatching {
|
||||
loginModule()
|
||||
|
|
|
@ -75,7 +75,7 @@ internal interface MessagesService {
|
|||
): List<MessageMeta>
|
||||
|
||||
@GET("api/WiadomoscSzczegoly")
|
||||
suspend fun getMessageDetails(@Query("apiGlobalKey") globalKey: String): MessageDetails
|
||||
suspend fun getMessageDetails(@Query("apiGlobalKey") globalKey: String): MessageDetails?
|
||||
|
||||
@PUT("api/WiadomoscSzczegoly")
|
||||
suspend fun markMessageAsRead(@Body body: Map<String, String>)
|
||||
|
|
Loading…
Reference in a new issue