Skip to content

Commit 522fa20

Browse files
committed
chore: fix user card crashes when blocked by user
1 parent ff08a7f commit 522fa20

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

web/admin/components/user-card.vue

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,20 @@ const loading = ref(false);
2020
const showRolesModal = ref(false);
2121
const data = ref<ProfileViewDetailed>();
2222
const labels = ref<Array<BlueskyLabel>>([]);
23+
const postsError = ref<string>("");
24+
2325
const loadProfile = async () => {
26+
postsError.value = "";
2427
const labelsQuery = useBlueskyLabels(props.did);
2528
data.value = await getProfile(props.did);
2629
27-
posts.value = await newAgent()
28-
.getAuthorFeed({ actor: props.did })
29-
.then((r) => r.data.feed);
30+
try {
31+
posts.value = await newAgent()
32+
.getAuthorFeed({ actor: props.did })
33+
.then((r) => r.data.feed);
34+
} catch (error) {
35+
postsError.value = String(error);
36+
}
3037
labels.value = await labelsQuery;
3138
};
3239
@@ -196,12 +203,20 @@ await loadProfile();
196203
</shared-card>
197204
</div>
198205
<div class="mb-3 md:w-[50%]">
206+
<shared-card v-if="postsError" variant="error">
207+
Cannot show posts:
208+
{{ postsError.replace(/^Error:/i, "").replace(`: ${did}`, "") }}
209+
</shared-card>
199210
<shared-card
200-
v-if="actor"
211+
v-else-if="actor"
201212
:class="{ 'loading-flash': loading }"
202213
no-padding
203214
>
204-
<user-recent-posts :actor-did="actor.did" :posts="posts" />
215+
<user-recent-posts
216+
v-if="posts"
217+
:actor-did="actor.did"
218+
:posts="posts"
219+
/>
205220
</shared-card>
206221
</div>
207222
</div>

0 commit comments

Comments
 (0)