arrelgado tema de pagina de htags

This commit is contained in:
2025-12-21 22:53:27 -03:00
parent e58985b1e2
commit 08e84a1e27
4 changed files with 108 additions and 1 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 obtenerCantidadDeUsosdeHtag(htag: string) {
if (!htag) return null;
try {
const req = await fetch(`${get(apiBase)}/api/posts/hashtag/${htag}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}
});
if (req.ok) {
let data = await req.json();
return data;
}
return null;
} catch {
return null;
}
}