actualizada interfaz de seguidos y seguidores

This commit is contained in:
2026-01-08 17:32:50 -03:00
parent b69e2f19ab
commit 0e924bfc31
4 changed files with 93 additions and 28 deletions

View File

@@ -3,16 +3,26 @@ import type { User, UserResponseDto } from '../../types.js';
import { error } from '@sveltejs/kit';
import { obtenerSeguidosPorUsuario } from '@/hooks/obtenerSeguidosPorUsuario.js';
import { obtenerSeguidoresPorUsuario } from '@/hooks/obtenerSeguidoresPorUsuario.js';
import { obtenerCantidadDeSeguidores } from '@/hooks/obtenerCantidadDeSeguidores.js';
import { obtenerCantidadDeSeguidos } from '@/hooks/obtenerCantidadDeSeguidos.js';
export async function load({ params, depends, fetch }) {
depends('perfil:general');
const usuario: UserResponseDto | null = await obtenerUsuarioPorUsername(params.perfil, fetch);
if (!usuario) error(404, 'No se encontro el usuario, ' + params.perfil);
const [seguidos, seguidores] = await Promise.all([
obtenerSeguidosPorUsuario(usuario.id, 3, fetch),
obtenerSeguidoresPorUsuario(usuario.id, 3, fetch)
const [seguidos, seguidores, countSeguidores, countSeguidos] = await Promise.all([
obtenerSeguidosPorUsuario(usuario.id, 5, fetch),
obtenerSeguidoresPorUsuario(usuario.id, 5, fetch),
obtenerCantidadDeSeguidores(usuario.id, fetch),
obtenerCantidadDeSeguidos(usuario.id, fetch)
]);
return { ...usuario, seguidos, seguidores };
return {
...usuario,
seguidos,
seguidores,
countSeguidores: countSeguidores.count,
countSeguidos: countSeguidos.count
};
}