mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-28 17:22:47 -03:00
26 lines
670 B
TypeScript
26 lines
670 B
TypeScript
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;
|
|
}
|
|
}
|