algunos arreglos a la ui y correjido un cambio en una api

This commit is contained in:
2025-12-22 20:19:42 -03:00
parent ae381c00ff
commit 252e1d0b98
7 changed files with 156 additions and 130 deletions

View File

@@ -1,25 +1,28 @@
import { sesionStore } from "@/stores/usuario";
import type { UserResponseDto } from "../../types";
import { get } from "svelte/store";
import { apiBase } from "@/stores/url";
import { sesionStore } from '@/stores/usuario';
import type { UsersResponseDto } from '../../types';
import { get } from 'svelte/store';
import { apiBase } from '@/stores/url';
export async function obtenerSeguidoresPorUsuario(id: string, limit:number = 20): Promise<UserResponseDto[] | null> {
try {
const response = await fetch(`${get(apiBase)}/api/users/${id}/followers?limit=${limit}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}
});
export async function obtenerSeguidoresPorUsuario(
id: string,
limit: number = 20
): Promise<UsersResponseDto | null> {
try {
const response = await fetch(`${get(apiBase)}/api/users/${id}/followers?limit=${limit}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}
});
if (!response.ok) {
return null;
}
if (!response.ok) {
return null;
}
const followers: UserResponseDto[] = await response.json();
return followers;
} catch (error) {
return null;
}
const followers: UsersResponseDto = await response.json();
return followers;
} catch (error) {
return null;
}
}

View File

@@ -1,25 +1,28 @@
import { sesionStore } from "@/stores/usuario";
import type { UserResponseDto } from "../../types";
import { apiBase } from "@/stores/url";
import { get } from "svelte/store";
import { sesionStore } from '@/stores/usuario';
import type { UsersResponseDto } from '../../types';
import { apiBase } from '@/stores/url';
import { get } from 'svelte/store';
export async function obtenerSeguidosPorUsuario(id: string, limit:number = 20): Promise<UserResponseDto[] | null> {
try {
const response = await fetch(`${get(apiBase)}/api/users/${id}/following?limit=${limit}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}
});
export async function obtenerSeguidosPorUsuario(
id: string,
limit: number = 20
): Promise<UsersResponseDto | null> {
try {
const response = await fetch(`${get(apiBase)}/api/users/${id}/following?limit=${limit}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}
});
if (!response.ok) {
return null;
}
if (!response.ok) {
return null;
}
const users: UserResponseDto[] = await response.json();
return users;
} catch (error) {
return null;
}
const users: UsersResponseDto = await response.json();
return users;
} catch (error) {
return null;
}
}