diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-09-26 13:38:37 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-09-26 13:38:37 -0500 |
commit | 2e352f383ec50cb45f39ed7b53c85fb6ea991bda (patch) | |
tree | 8232d2b158c7a34a9ff6b27482fd62427ed37018 /src/state/models/root-store.ts | |
parent | a8c8286b88eae3e7db23555be90cb9673361be20 (diff) | |
download | voidsky-2e352f383ec50cb45f39ed7b53c85fb6ea991bda.tar.zst |
A few client fixes
Diffstat (limited to 'src/state/models/root-store.ts')
-rw-r--r-- | src/state/models/root-store.ts | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/state/models/root-store.ts b/src/state/models/root-store.ts index adbcb2389..ea3da1859 100644 --- a/src/state/models/root-store.ts +++ b/src/state/models/root-store.ts @@ -3,7 +3,8 @@ */ import {makeAutoObservable} from 'mobx' -import AdxApi, {ServiceClient} from '../../third-party/api' +import AdxApi from '../../third-party/api' +import {ServiceClient} from '../../third-party/api/src/index' import {createContext, useContext} from 'react' import {isObj, hasProp} from '../lib/type-guards' import {SessionModel} from './session' @@ -27,11 +28,14 @@ export class RootStoreModel { } async resolveName(didOrName: string) { - throw new Error('TODO') - return '' - // const userDb = this.api.mockDb.getUser(didOrName) - // if (!userDb) throw new Error(`User not found: ${didOrName}`) - // return userDb.did + if (!didOrName) { + throw new Error('Invalid name: ""') + } + if (didOrName.startsWith('did:')) { + return didOrName + } + const res = await this.api.todo.adx.resolveName({name: didOrName}) + return res.data.did } serialize(): unknown { |