mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Migrate UserIdentityStore to TypeScript
This commit is contained in:
parent
b46ae152d6
commit
8d44df83c4
@ -26,7 +26,7 @@ import {RoomStateStore} from "./stores/RoomStateStore";
|
|||||||
import {RoomMemberStore} from "./stores/RoomMemberStore";
|
import {RoomMemberStore} from "./stores/RoomMemberStore";
|
||||||
import {TimelineFragmentStore} from "./stores/TimelineFragmentStore";
|
import {TimelineFragmentStore} from "./stores/TimelineFragmentStore";
|
||||||
import {PendingEventStore} from "./stores/PendingEventStore";
|
import {PendingEventStore} from "./stores/PendingEventStore";
|
||||||
import {UserIdentityStore} from "./stores/UserIdentityStore.js";
|
import {UserIdentityStore} from "./stores/UserIdentityStore";
|
||||||
import {DeviceIdentityStore} from "./stores/DeviceIdentityStore.js";
|
import {DeviceIdentityStore} from "./stores/DeviceIdentityStore.js";
|
||||||
import {OlmSessionStore} from "./stores/OlmSessionStore.js";
|
import {OlmSessionStore} from "./stores/OlmSessionStore.js";
|
||||||
import {InboundGroupSessionStore} from "./stores/InboundGroupSessionStore.js";
|
import {InboundGroupSessionStore} from "./stores/InboundGroupSessionStore.js";
|
||||||
|
@ -13,21 +13,30 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import {Store} from "../Store";
|
||||||
|
|
||||||
|
interface UserIdentity {
|
||||||
|
userId: string;
|
||||||
|
roomIds: string[];
|
||||||
|
deviceTrackingStatus: number;
|
||||||
|
}
|
||||||
|
|
||||||
export class UserIdentityStore {
|
export class UserIdentityStore {
|
||||||
constructor(store) {
|
private _store: Store<UserIdentity>;
|
||||||
|
|
||||||
|
constructor(store: Store<UserIdentity>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
}
|
}
|
||||||
|
|
||||||
get(userId) {
|
get(userId: string): Promise<UserIdentity | null> {
|
||||||
return this._store.get(userId);
|
return this._store.get(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
set(userIdentity) {
|
set(userIdentity: UserIdentity): Promise<IDBValidKey> {
|
||||||
this._store.put(userIdentity);
|
return this._store.put(userIdentity);
|
||||||
}
|
}
|
||||||
|
|
||||||
remove(userId) {
|
remove(userId: string): Promise<undefined> {
|
||||||
return this._store.delete(userId);
|
return this._store.delete(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user