mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-01 13:10:44 -03:00
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:
@@ -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}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
`${$apiBase}/api/posts/user/${params.perfil}?page=${pageNumber}&pageSize=20`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${$sesionStore?.accessToken}`
|
||||
Authorization: `Bearer ${$sesionStore?.accessToken || ''}`
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -103,10 +103,12 @@
|
||||
</Content>
|
||||
</Card>
|
||||
{/if}
|
||||
<div class="my-4">
|
||||
<Separator></Separator>
|
||||
</div>
|
||||
<CrearPost placeholder={`Responder a @${data.post.authorName}`} parentPostId={data.post.id} />
|
||||
{#if $sesionStore}
|
||||
<div class="my-4">
|
||||
<Separator></Separator>
|
||||
</div>
|
||||
<CrearPost placeholder={`Responder a @${data.post.authorName}`} parentPostId={data.post.id} />
|
||||
{/if}
|
||||
|
||||
<div class="my-4">
|
||||
<Separator></Separator>
|
||||
@@ -211,8 +213,8 @@
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Borrar</TooltipContent>
|
||||
</Tooltip>
|
||||
<BotonSeguir {post} variant="icon-sm" />
|
||||
{/if}
|
||||
<BotonSeguir {post} variant="icon-sm" />
|
||||
</div>
|
||||
</div>
|
||||
<p class=" mt-1 line-clamp-2 rounded-md p-2 text-lg">
|
||||
|
||||
Reference in New Issue
Block a user