mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
allow to join room by id or alias
This commit is contained in:
parent
a4d3b5f013
commit
9679058081
@ -717,6 +717,13 @@ export class Session {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
joinRoom(roomIdOrAlias, log = null) {
|
||||
return this._platform.logger.wrapOrRun(log, "joinRoom", async log => {
|
||||
const body = await this._hsApi.joinIdOrAlias(roomIdOrAlias).response();
|
||||
return body.room_id;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function tests() {
|
||||
|
@ -190,6 +190,10 @@ export class HomeServerApi {
|
||||
return this._post(`/rooms/${encodeURIComponent(roomId)}/join`, null, null, options);
|
||||
}
|
||||
|
||||
joinIdOrAlias(roomIdOrAlias, options = null) {
|
||||
return this._post(`/join/${encodeURIComponent(roomIdOrAlias)}`, null, null, options);
|
||||
}
|
||||
|
||||
leave(roomId, options = null) {
|
||||
return this._post(`/rooms/${encodeURIComponent(roomId)}/leave`, null, null, options);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user