about summary refs log tree commit diff
path: root/src/state/models/root-store.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-11-04 17:39:54 -0500
committerPaul Frazee <pfrazee@gmail.com>2022-11-04 17:39:54 -0500
commitf333a90fab79d582bbb7f9114f0b005fdb1cae8b (patch)
tree631755be2dd6976e9d0efd90f33751c52a09ef37 /src/state/models/root-store.ts
parent8ae6e67eea8890f639dbaa9423e99cad5e28502f (diff)
downloadvoidsky-f333a90fab79d582bbb7f9114f0b005fdb1cae8b.tar.zst
Update to the latest APIs
Diffstat (limited to 'src/state/models/root-store.ts')
-rw-r--r--src/state/models/root-store.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/state/models/root-store.ts b/src/state/models/root-store.ts
index 949049a18..68b042d68 100644
--- a/src/state/models/root-store.ts
+++ b/src/state/models/root-store.ts
@@ -3,8 +3,8 @@
  */
 
 import {makeAutoObservable} from 'mobx'
-import AtpApi from '../../third-party/api'
-import type {ServiceClient} from '../../third-party/api/src/index'
+import {sessionClient as AtpApi} from '../../third-party/api'
+import type {SessionServiceClient} from '../../third-party/api/src/index'
 import {createContext, useContext} from 'react'
 import {isObj, hasProp} from '../lib/type-guards'
 import {SessionModel} from './session'
@@ -18,7 +18,7 @@ export class RootStoreModel {
   shell = new ShellModel()
   me = new MeModel(this)
 
-  constructor(public api: ServiceClient) {
+  constructor(public api: SessionServiceClient) {
     makeAutoObservable(this, {
       api: false,
       resolveName: false,
@@ -27,14 +27,14 @@ export class RootStoreModel {
     })
   }
 
-  async resolveName(didOrName: string) {
-    if (!didOrName) {
-      throw new Error('Invalid name: ""')
+  async resolveName(didOrHandle: string) {
+    if (!didOrHandle) {
+      throw new Error('Invalid handle: ""')
     }
-    if (didOrName.startsWith('did:')) {
-      return didOrName
+    if (didOrHandle.startsWith('did:')) {
+      return didOrHandle
     }
-    const res = await this.api.com.atproto.resolveName({name: didOrName})
+    const res = await this.api.com.atproto.handle.resolve({handle: didOrHandle})
     return res.data.did
   }