add pagination to the post hashtag

This commit is contained in:
Fran
2026-02-06 18:29:07 -03:00
parent 1da53348d0
commit 70093ce186
3 changed files with 47 additions and 39 deletions

View File

@@ -2,11 +2,15 @@ import { apiBase } from '@/stores/url';
import { sesionStore } from '@/stores/usuario';
import { get } from 'svelte/store';
export async function obtenerCantidadDeUsosdeHtag(htag: string, fetch2?: Function) {
export async function obtenerCantidadDeUsosdeHtag(
htag: string,
fetch2?: Function,
page: number = 1,
limit: number = 20,) {
if (!htag) return null;
const fetchFn = fetch2 || fetch;
try {
const req = await fetchFn(`${get(apiBase)}/api/posts/hashtag/${htag}`, {
const req = await fetchFn(`${get(apiBase)}/api/posts/hashtag/${htag}?page=${page}&pageSize=${limit}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${get(sesionStore)?.accessToken || ''}`