feat: fetch full members list when navigating to own user page
This commit is contained in:
parent
26b0d297ab
commit
f252340b3a
1 changed files with 14 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
|
@ -113,6 +114,19 @@
|
||||||
await navigator.clipboard.writeText(url);
|
await navigator.clipboard.writeText(url);
|
||||||
addToast({ body: "Copied the link to your clipboard!", duration: 2000 });
|
addToast({ body: "Copied the link to your clipboard!", duration: 2000 });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
if ($userStore && $userStore.id === data.id) {
|
||||||
|
console.log("User is current user, fetching members")
|
||||||
|
try {
|
||||||
|
const members = await apiFetchClient<PartialMember[]>("/users/@me/members");
|
||||||
|
data.members = members;
|
||||||
|
} catch (e) {
|
||||||
|
// If it fails, we fail silently but log to console anyway
|
||||||
|
console.error("Fetching members:", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
Loading…
Reference in a new issue