network calls to accept and reject invite

This commit is contained in:
Bruno Windels 2021-04-20 19:02:45 +02:00
parent bb1c64e1ac
commit 5ce138539b
2 changed files with 10 additions and 0 deletions

View file

@ -185,6 +185,14 @@ export class HomeServerApi {
getPushers(options = null) { getPushers(options = null) {
return this._get("/pushers", null, null, options); return this._get("/pushers", null, null, options);
} }
join(roomId, options = null) {
return this._post(`/rooms/${encodeURIComponent(roomId)}/join`, null, null, options);
}
leave(roomId, options = null) {
return this._post(`/rooms/${encodeURIComponent(roomId)}/leave`, null, null, options);
}
} }
import {Request as MockRequest} from "../../mocks/Request.js"; import {Request as MockRequest} from "../../mocks/Request.js";

View file

@ -70,11 +70,13 @@ export class Invite extends EventEmitter {
async accept() { async accept() {
this._accepting = true; this._accepting = true;
this._emitChange("accepting"); this._emitChange("accepting");
await this._hsApi.join(this._roomId).response();
} }
async reject() { async reject() {
this._rejecting = true; this._rejecting = true;
this._emitChange("rejecting"); this._emitChange("rejecting");
await this._hsApi.leave(this._roomId).response();
} }
get accepting() { get accepting() {