diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-12 12:45:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-12 12:45:25 -0800 |
commit | d9e0a927c1c98ebd6aa3885ab517af27e7de2522 (patch) | |
tree | cee196297391e497f1aa3b650d66633f3a86ca34 /src/lib/api/index.ts | |
parent | 05b728fffcdb17708fdb52685725faf7fdc545bc (diff) | |
download | voidsky-d9e0a927c1c98ebd6aa3885ab517af27e7de2522.tar.zst |
Refactor lists to use new queries (#1875)
* Refactor lists queries to react-query * Delete old lists-list model * Implement list, list-members, and list-memberships react-queries * Update CreateOrEditList modal * First pass at my-follows and actor-autocomplete queries * Update ListAddUserModal to use new queries, change to ListAddRemoveUsersModal * Update UserAddRemoveLists modal * Remove old TODO * Fix indent, autocomplete query * Add a todo --------- Co-authored-by: Eric Bailey <git@esb.lol>
Diffstat (limited to 'src/lib/api/index.ts')
-rw-r--r-- | src/lib/api/index.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 9d48a78c0..a98834888 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -4,6 +4,7 @@ import { AppBskyEmbedRecord, AppBskyEmbedRecordWithMedia, AppBskyRichtextFacet, + BskyAgent, ComAtprotoLabelDefs, ComAtprotoRepoUploadBlob, RichText, @@ -53,18 +54,18 @@ export async function resolveName(store: RootStoreModel, didOrHandle: string) { } export async function uploadBlob( - store: RootStoreModel, + agent: BskyAgent, blob: string, encoding: string, ): Promise<ComAtprotoRepoUploadBlob.Response> { if (isWeb) { // `blob` should be a data uri - return store.agent.uploadBlob(convertDataURIToUint8Array(blob), { + return agent.uploadBlob(convertDataURIToUint8Array(blob), { encoding, }) } else { // `blob` should be a path to a file in the local FS - return store.agent.uploadBlob( + return agent.uploadBlob( blob, // this will be special-cased by the fetch monkeypatch in /src/state/lib/api.ts {encoding}, ) @@ -135,7 +136,7 @@ export async function post(store: RootStoreModel, opts: PostOpts) { await image.compress() const path = image.compressed?.path ?? image.path const {width, height} = image.compressed || image - const res = await uploadBlob(store, path, 'image/jpeg') + const res = await uploadBlob(store.agent, path, 'image/jpeg') images.push({ image: res.data.blob, alt: image.altText ?? '', @@ -185,7 +186,7 @@ export async function post(store: RootStoreModel, opts: PostOpts) { } if (encoding) { const thumbUploadRes = await uploadBlob( - store, + store.agent, opts.extLink.localThumb.path, encoding, ) |