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 usu = $state({ displayName: data.displayName, bio: data.bio });
|
||||||
|
|
||||||
let contenido = $derived(() => {
|
let contenido = $derived(() => {
|
||||||
|
if (data.bio == '') return '';
|
||||||
let t = data.bio
|
let t = data.bio
|
||||||
.replaceAll('&', '')
|
.replaceAll('&', '')
|
||||||
.replaceAll('<', '')
|
.replaceAll('<', '')
|
||||||
@@ -134,7 +135,7 @@
|
|||||||
</h1>
|
</h1>
|
||||||
{#if data.bio}
|
{#if data.bio}
|
||||||
<p class="mt-4 rounded-4xl bg-accent p-4 text-center text-muted-foreground">
|
<p class="mt-4 rounded-4xl bg-accent p-4 text-center text-muted-foreground">
|
||||||
{@html usu.bio.replaceAll('\n', '<br>')}
|
{@html contenido()}
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export async function obtenerPostPorId(
|
|||||||
const req = await fetchFn(`${get(apiBase)}/api/posts/${idpost}`, {
|
const req = await fetchFn(`${get(apiBase)}/api/posts/${idpost}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
|
Authorization: `Bearer ${get(sesionStore)?.accessToken || ''}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let data = await req.json();
|
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}`, {
|
const req = await fetchFn(`${get(apiBase)}/api/posts/${id}/replies?page=${page}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
|
Authorization: `Bearer ${get(sesionStore)?.accessToken || ''}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (req.ok) {
|
if (req.ok) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
`${$apiBase}/api/posts/user/${params.perfil}?page=${pageNumber}&pageSize=20`,
|
`${$apiBase}/api/posts/user/${params.perfil}?page=${pageNumber}&pageSize=20`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${$sesionStore?.accessToken}`
|
Authorization: `Bearer ${$sesionStore?.accessToken || ''}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -103,10 +103,12 @@
|
|||||||
</Content>
|
</Content>
|
||||||
</Card>
|
</Card>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="my-4">
|
{#if $sesionStore}
|
||||||
<Separator></Separator>
|
<div class="my-4">
|
||||||
</div>
|
<Separator></Separator>
|
||||||
<CrearPost placeholder={`Responder a @${data.post.authorName}`} parentPostId={data.post.id} />
|
</div>
|
||||||
|
<CrearPost placeholder={`Responder a @${data.post.authorName}`} parentPostId={data.post.id} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div class="my-4">
|
<div class="my-4">
|
||||||
<Separator></Separator>
|
<Separator></Separator>
|
||||||
@@ -211,8 +213,8 @@
|
|||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent>Borrar</TooltipContent>
|
<TooltipContent>Borrar</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
<BotonSeguir {post} variant="icon-sm" />
|
||||||
{/if}
|
{/if}
|
||||||
<BotonSeguir {post} variant="icon-sm" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class=" mt-1 line-clamp-2 rounded-md p-2 text-lg">
|
<p class=" mt-1 line-clamp-2 rounded-md p-2 text-lg">
|
||||||
|
|||||||
Reference in New Issue
Block a user