diff options
Diffstat (limited to 'src/state/models/me.ts')
-rw-r--r-- | src/state/models/me.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/state/models/me.ts b/src/state/models/me.ts index 70f45097d..cefd893ca 100644 --- a/src/state/models/me.ts +++ b/src/state/models/me.ts @@ -1,5 +1,6 @@ import {makeAutoObservable, runInAction} from 'mobx' import {RootStoreModel} from './root-store' +import {MembershipsViewModel} from './memberships-view' export class MeModel { did?: string @@ -7,6 +8,7 @@ export class MeModel { displayName?: string description?: string notificationCount: number = 0 + memberships?: MembershipsViewModel constructor(public rootStore: RootStoreModel) { makeAutoObservable(this, {rootStore: false}, {autoBind: true}) @@ -18,6 +20,7 @@ export class MeModel { this.displayName = undefined this.description = undefined this.notificationCount = 0 + this.memberships = undefined } async load() { @@ -37,6 +40,10 @@ export class MeModel { this.description = '' } }) + this.memberships = new MembershipsViewModel(this.rootStore, { + actor: this.did, + }) + await this.memberships?.setup() } else { this.clear() } @@ -48,4 +55,8 @@ export class MeModel { this.notificationCount = res.data.count }) } + + async refreshMemberships() { + return this.memberships?.refresh() + } } |