diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-11-04 17:39:54 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-11-04 17:39:54 -0500 |
commit | f333a90fab79d582bbb7f9114f0b005fdb1cae8b (patch) | |
tree | 631755be2dd6976e9d0efd90f33751c52a09ef37 /src/state/models/user-follows-view.ts | |
parent | 8ae6e67eea8890f639dbaa9423e99cad5e28502f (diff) | |
download | voidsky-f333a90fab79d582bbb7f9114f0b005fdb1cae8b.tar.zst |
Update to the latest APIs
Diffstat (limited to 'src/state/models/user-follows-view.ts')
-rw-r--r-- | src/state/models/user-follows-view.ts | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/state/models/user-follows-view.ts b/src/state/models/user-follows-view.ts index 92f9b4bc4..b7875c22c 100644 --- a/src/state/models/user-follows-view.ts +++ b/src/state/models/user-follows-view.ts @@ -1,9 +1,9 @@ import {makeAutoObservable} from 'mobx' -import * as GetUserFollows from '../../third-party/api/src/types/app/bsky/getUserFollows' +import * as GetFollows from '../../third-party/api/src/client/types/app/bsky/graph/getFollows' import {RootStoreModel} from './root-store' -type Subject = GetUserFollows.OutputSchema['subject'] -export type FollowItem = GetUserFollows.OutputSchema['follows'][number] & { +type Subject = GetFollows.OutputSchema['subject'] +export type FollowItem = GetFollows.OutputSchema['follows'][number] & { _reactKey: string } @@ -13,15 +13,15 @@ export class UserFollowsViewModel { isRefreshing = false hasLoaded = false error = '' - params: GetUserFollows.QueryParams + params: GetFollows.QueryParams // data - subject: Subject = {did: '', name: '', displayName: ''} + subject: Subject = {did: '', handle: '', displayName: ''} follows: FollowItem[] = [] constructor( public rootStore: RootStoreModel, - params: GetUserFollows.QueryParams, + params: GetFollows.QueryParams, ) { makeAutoObservable( this, @@ -83,7 +83,9 @@ export class UserFollowsViewModel { private async _fetch(isRefreshing = false) { this._xLoading(isRefreshing) try { - const res = await this.rootStore.api.app.bsky.getUserFollows(this.params) + const res = await this.rootStore.api.app.bsky.graph.getFollows( + this.params, + ) this._replaceAll(res) this._xIdle() } catch (e: any) { @@ -91,9 +93,9 @@ export class UserFollowsViewModel { } } - private _replaceAll(res: GetUserFollows.Response) { + private _replaceAll(res: GetFollows.Response) { this.subject.did = res.data.subject.did - this.subject.name = res.data.subject.name + this.subject.handle = res.data.subject.handle this.subject.displayName = res.data.subject.displayName this.follows.length = 0 let counter = 0 |