mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-29 17:32:46 -03:00
24 lines
779 B
TypeScript
24 lines
779 B
TypeScript
import { obtenerUsuarioPorUsername } from '@/hooks/obtenerUsuario';
|
|
import { error } from '@sveltejs/kit';
|
|
import type { PageLoad } from './$types';
|
|
import type { UserResponseDto, UsersResponseDto } from '../../../types';
|
|
import { obtenerSeguidosPorUsuario } from '@/hooks/obtenerSeguidosPorUsuario';
|
|
|
|
export const load: PageLoad = async ({ params, fetch }) => {
|
|
const usuario: UserResponseDto | null = await obtenerUsuarioPorUsername(params.perfil, fetch);
|
|
if (!usuario) error(404, 'No se encontro el usuario, ' + params.perfil);
|
|
|
|
const seguidosResponse: UsersResponseDto | null = await obtenerSeguidosPorUsuario(
|
|
usuario.id,
|
|
1,
|
|
100,
|
|
fetch
|
|
);
|
|
|
|
return {
|
|
usuario,
|
|
seguidos: seguidosResponse?.response || [],
|
|
totalCount: seguidosResponse?.totalCount ?? 0
|
|
};
|
|
};
|