mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Migrate InviteStore.js to TypeScript.
This commit is contained in:
parent
7c56ac7746
commit
7de704ef86
@ -19,7 +19,7 @@ import {StorageError} from "../common";
|
||||
import {Store} from "./Store";
|
||||
import {SessionStore} from "./stores/SessionStore";
|
||||
import {RoomSummaryStore} from "./stores/RoomSummaryStore";
|
||||
import {InviteStore} from "./stores/InviteStore.js";
|
||||
import {InviteStore} from "./stores/InviteStore";
|
||||
import {TimelineEventStore} from "./stores/TimelineEventStore.js";
|
||||
import {TimelineRelationStore} from "./stores/TimelineRelationStore.js";
|
||||
import {RoomStateStore} from "./stores/RoomStateStore.js";
|
||||
|
@ -13,21 +13,39 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
import {Store} from "../Store";
|
||||
import {MemberData} from "./RoomMemberStore";
|
||||
|
||||
// TODO: Move to Invite when that's TypeScript.
|
||||
export interface InviteData {
|
||||
roomId: string;
|
||||
isEncrypted: boolean;
|
||||
isDirectMessage: boolean;
|
||||
name?: string;
|
||||
avatarUrl?: string;
|
||||
avatarColorId: number;
|
||||
canonicalAlias?: string;
|
||||
timestamp: number;
|
||||
joinRule: string;
|
||||
inviter?: MemberData;
|
||||
}
|
||||
|
||||
export class InviteStore {
|
||||
constructor(inviteStore) {
|
||||
private _inviteStore: Store<InviteData>;
|
||||
|
||||
constructor(inviteStore: Store<InviteData>) {
|
||||
this._inviteStore = inviteStore;
|
||||
}
|
||||
|
||||
getAll() {
|
||||
getAll(): Promise<InviteData[]> {
|
||||
return this._inviteStore.selectAll();
|
||||
}
|
||||
|
||||
set(invite) {
|
||||
set(invite: InviteData): Promise<IDBValidKey> {
|
||||
return this._inviteStore.put(invite);
|
||||
}
|
||||
|
||||
remove(roomId) {
|
||||
remove(roomId: string): void {
|
||||
this._inviteStore.delete(roomId);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user