fix: fallaba la carga de posts

lo que pasa es que el $session?.accessToken si $session es null va a dar
undefined y eso entra interpretado como un string a el header de auth
This commit is contained in:
2026-02-05 21:29:30 -03:00
parent 52c583a039
commit 9546b6548d
5 changed files with 12 additions and 9 deletions

View File

@@ -29,6 +29,7 @@
let usu = $state({ displayName: data.displayName, bio: data.bio });
let contenido = $derived(() => {
if (data.bio == '') return '';
let t = data.bio
.replaceAll('&', '')
.replaceAll('<', '')
@@ -134,7 +135,7 @@
</h1>
{#if data.bio}
<p class="mt-4 rounded-4xl bg-accent p-4 text-center text-muted-foreground">
{@html usu.bio.replaceAll('\n', '<br>')}
{@html contenido()}
</p>
{/if}
{/if}

View File

@@ -16,7 +16,7 @@ export async function obtenerPostPorId(
const req = await fetchFn(`${get(apiBase)}/api/posts/${idpost}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
Authorization: `Bearer ${get(sesionStore)?.accessToken || ''}`
}
});
let data = await req.json();

View File

@@ -15,7 +15,7 @@ export async function obtenerRespuestasPorId(
const req = await fetchFn(`${get(apiBase)}/api/posts/${id}/replies?page=${page}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
Authorization: `Bearer ${get(sesionStore)?.accessToken || ''}`
}
});
if (req.ok) {