feat(components): add "shared ip" section to admin panel
This commit is contained in:
		
							parent
							
								
									bd9e3d5336
								
							
						
					
					
						commit
						41e24f4a8e
					
				| @ -7,6 +7,10 @@ | |||||||
| 	const short = props.user?.profile.isAdmin; | 	const short = props.user?.profile.isAdmin; | ||||||
| 	const showBanUnban = ref<boolean>(false); | 	const showBanUnban = ref<boolean>(false); | ||||||
| 	const showDemote = 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 () => { | 	const handle = async () => { | ||||||
| 		await useApiFetch(`/user/${props.user?._id}/ban`, { | 		await useApiFetch(`/user/${props.user?._id}/ban`, { | ||||||
| 			method: "post", | 			method: "post", | ||||||
| @ -48,7 +52,25 @@ | |||||||
| 				<a-descriptions-item label="IP addresses"> | 				<a-descriptions-item label="IP addresses"> | ||||||
| 					<a-list :data-source="user?.ipLog"> | 					<a-list :data-source="user?.ipLog"> | ||||||
| 						<template #renderItem="{ item }"> | 						<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> | 						</template> | ||||||
| 					</a-list> | 					</a-list> | ||||||
| 				</a-descriptions-item> | 				</a-descriptions-item> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user