feat(components): add "shared ip" section to admin panel

This commit is contained in:
parent bd9e3d5336
commit 41e24f4a8e
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -7,6 +7,10 @@
const short = props.user?.profile.isAdmin;
const showBanUnban = ref<boolean>(false);
const showDemote = ref<boolean>(false);
const { data: commonIps } = await useApiFetch<{
[key: string]: { _id: number; username: string }[];
}>(`/user/${props.user!._id}/shared-ip`);
const handle = async () => {
await useApiFetch(`/user/${props.user?._id}/ban`, {
method: "post",
@ -48,7 +52,25 @@
<a-descriptions-item label="IP addresses">
<a-list :data-source="user?.ipLog">
<template #renderItem="{ item }">
{{ item.ip }}
{{ item.ip }}<br />
<a-typography-title :level="5"
>Other users with this IP:</a-typography-title
>
<div v-if="commonIps != null">
<i v-if="!commonIps[item.ip]?.length">
No other users share this IP.
</i>
<a-list
v-else
:data-source="!!commonIps ? commonIps[item.ip] : []"
>
<template #renderItem="{ item: otherItem }">
<nuxt-link :to="`/user/${otherItem._id}`">
{{ otherItem.username }}
</nuxt-link>
</template>
</a-list>
</div>
</template>
</a-list>
</a-descriptions-item>