algunos refactor y ahora arregle lo que no se actualizaba la tarjeta de

perfil
This commit is contained in:
2025-12-26 01:37:10 -03:00
parent 6d2bb774d4
commit 9508b575f5
6 changed files with 91 additions and 90 deletions

View File

@@ -5,10 +5,12 @@ import { apiBase } from '@/stores/url';
export async function obtenerSeguidoresPorUsuario(
id: string,
limit: number = 20
limit: number = 20,
fetch2: Function
): Promise<UsersResponseDto | null> {
try {
const response = await fetch(`${get(apiBase)}/api/users/${id}/followers?limit=${limit}`, {
const fetchFunc = fetch2 || fetch;
const response = await fetchFunc(`${get(apiBase)}/api/users/${id}/followers?limit=${limit}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',

View File

@@ -5,10 +5,13 @@ import { get } from 'svelte/store';
export async function obtenerSeguidosPorUsuario(
id: string,
limit: number = 20
limit: number = 20,
fetch2?: Function
): Promise<UsersResponseDto | null> {
try {
const response = await fetch(`${get(apiBase)}/api/users/${id}/following?limit=${limit}`, {
const fetchFunc = fetch2 || fetch;
const response = await fetchFunc(`${get(apiBase)}/api/users/${id}/following?limit=${limit}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',

View File

@@ -3,9 +3,14 @@ import type { UserResponseDto } from '../../types';
import { get } from 'svelte/store';
import { sesionStore } from '@/stores/usuario';
export async function obtenerUsuarioPorUsername(username: string): Promise<UserResponseDto | null> {
export async function obtenerUsuarioPorUsername(
username: string,
fetch2?: Function
): Promise<UserResponseDto | null> {
try {
const response = await fetch(`${get(apiBase)}/api/users/username/${username}`, {
const fetchFunction = fetch2 || fetch;
const response = await fetchFunction(`${get(apiBase)}/api/users/username/${username}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',