setup `isAuthenticatedUser` in profileUiModel inside an action (#1272)

zio/stable
Ansh 2023-08-24 16:13:42 -07:00 committed by GitHub
parent c6f321862b
commit 7410bcd888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import {makeAutoObservable} from 'mobx' import {makeAutoObservable, runInAction} from 'mobx'
import {RootStoreModel} from '../root-store' import {RootStoreModel} from '../root-store'
import {ProfileModel} from '../content/profile' import {ProfileModel} from '../content/profile'
import {PostsFeedModel} from '../feeds/posts' import {PostsFeedModel} from '../feeds/posts'
@ -228,8 +228,10 @@ export class ProfileUiModel {
.setup() .setup()
.catch(err => this.rootStore.log.error('Failed to fetch feed', err)), .catch(err => this.rootStore.log.error('Failed to fetch feed', err)),
]) ])
this.isAuthenticatedUser = runInAction(() => {
this.profile.did === this.rootStore.session.currentSession?.did this.isAuthenticatedUser =
this.profile.did === this.rootStore.session.currentSession?.did
})
this.algos.refresh() this.algos.refresh()
// HACK: need to use the DID as a param, not the username -prf // HACK: need to use the DID as a param, not the username -prf
this.lists.source = this.profile.did this.lists.source = this.profile.did