diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-10-03 10:53:36 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-10-03 10:53:36 -0500 |
commit | c7d7e152a0e067a95b3d700147768d4244e464d1 (patch) | |
tree | 091b1a22f4fb7ff451976a3fbf806fbff859adab /src/state/models/me.ts | |
parent | b05a334dcbd6fbc5eb59da1d5cb111f683d5b1d8 (diff) | |
download | voidsky-c7d7e152a0e067a95b3d700147768d4244e464d1.tar.zst |
Implement notifications
Diffstat (limited to 'src/state/models/me.ts')
-rw-r--r-- | src/state/models/me.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/state/models/me.ts b/src/state/models/me.ts index 0a3627217..9e0c897ed 100644 --- a/src/state/models/me.ts +++ b/src/state/models/me.ts @@ -6,6 +6,7 @@ export class MeModel { name?: string displayName?: string description?: string + notificationCount: number = 0 constructor(public rootStore: RootStoreModel) { makeAutoObservable(this, {rootStore: false}, {autoBind: true}) @@ -16,6 +17,7 @@ export class MeModel { this.name = undefined this.displayName = undefined this.description = undefined + this.notificationCount = 0 } async load() { @@ -39,4 +41,11 @@ export class MeModel { this.clear() } } + + async fetchStateUpdate() { + const res = await this.rootStore.api.todo.social.getNotificationCount({}) + runInAction(() => { + this.notificationCount = res.data.count + }) + } } |