skeleton de la interfaz de seguidores y seguidos

This commit is contained in:
2025-12-02 21:13:02 -03:00
parent 942f270487
commit 324b6b388e
6 changed files with 161 additions and 24 deletions

View File

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

View File

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