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

@@ -0,0 +1,22 @@
import { apiBase } from '@/stores/url';
import { sesionStore } from '@/stores/usuario';
import { get } from 'svelte/store';
export async function obtenerCantidadDeSeguidores(id: string, fetch2?: Function) {
const fetchFn = fetch2 || fetch;
try {
const response = await fetchFn(`${get(apiBase)}/api/users/${id}/followers/count`, {
method: 'GET',
headers: {
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}
});
if (!response.ok) {
return 0;
}
return await response.json();
} catch {
return 0;
}
}

View File

@@ -0,0 +1,22 @@
import { apiBase } from '@/stores/url';
import { sesionStore } from '@/stores/usuario';
import { get } from 'svelte/store';
export async function obtenerCantidadDeSeguidos(id: string, fetch2?: Function) {
const fetchFn = fetch2 || fetch;
try {
const response = await fetchFn(`${get(apiBase)}/api/users/${id}/following/count`, {
method: 'GET',
headers: {
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}
});
if (!response.ok) {
return 0;
}
return await response.json();
} catch {
return 0;
}
}