Skip to content

Commit

Permalink
Merge pull request #226 from strideynet/kevslashnull/admin-empty-rece…
Browse files Browse the repository at this point in the history
…nt-posts

Fix recent posts are empty and not updating
  • Loading branch information
KevSlashNull authored Nov 27, 2023
2 parents 4fad157 + 6e37089 commit d369762
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions web/admin/components/user-card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Actor, ActorStatus } from "../../proto/bff/v1/types_pb";
import { getProfile } from "~/lib/cached-bsky";
import { newAgent } from "~/lib/auth";
import { ViewImage } from "@atproto/api/dist/client/types/app/bsky/embed/images";
import { PostView } from "@atproto/api/dist/client/types/app/bsky/feed/defs";
const props = defineProps<{
did: string;
Expand All @@ -23,6 +24,14 @@ const loadProfile = async () => {
.getActor({ did: data.value?.did || props.did })
.catch(() => ({ actor: undefined }));
actor.value = response?.actor;
posts.value = await newAgent()
.getAuthorFeed({ actor: props.did })
.then((r) =>
r.data.feed
.filter((p) => !p.reply && p.post.author.did === props.did)
.map((p) => p.post)
);
};
async function next() {
Expand Down Expand Up @@ -51,13 +60,7 @@ function addSISuffix(number?: number) {
return `${Math.round(number * 100) / 100}${suffixes[order] || ""}`;
}
const posts = await newAgent()
.getAuthorFeed({ actor: props.did })
.then((r) =>
r.data.feed
.filter((p) => !p.reply && p.post.author.did === props.did)
.map((p) => p.post)
);
const posts = ref<PostView[]>([]);
await loadProfile();
</script>
Expand Down Expand Up @@ -209,6 +212,12 @@ await loadProfile();
Error: post not found.
</div>
</div>
<div
v-if="posts.length === 0"
class="text-muted px-4 py-2 border-gray-300 dark:border-gray-700"
>
No recent posts.
</div>
</div>
</shared-card>
</div>
Expand Down

1 comment on commit d369762

@vercel
Copy link

@vercel vercel bot commented on d369762 Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.