diff --git a/lib/src/Client.dart b/lib/src/Client.dart index 5cdc7fa..3b85da4 100644 --- a/lib/src/Client.dart +++ b/lib/src/Client.dart @@ -183,7 +183,7 @@ class Client { Future logout() async { final dynamic resp = await connection.jsonRequest( type: "POST", action: "/client/r0/logout/all"); - if (resp == null) return; + if (resp is ErrorResponse) connection.onError.add(resp); await connection.clear(); } @@ -194,11 +194,16 @@ class Client { List inviteIDs = []; for (int i = 0; i < users.length; i++) inviteIDs.add(users[i].id); - Map resp = await connection.jsonRequest( + final dynamic resp = await connection.jsonRequest( type: "POST", action: "/client/r0/createRoom", data: {"invite": inviteIDs, "preset": "private_chat"}); + if (resp is ErrorResponse) { + connection.onError.add(resp); + return null; + } + return resp["room_id"]; } }