arrelgado tema de pagina de htags

This commit is contained in:
2025-12-21 22:53:27 -03:00
parent e58985b1e2
commit 08e84a1e27
4 changed files with 108 additions and 1 deletions

View File

@@ -47,7 +47,7 @@
let contenido = $derived(() => {
let t = post.content.replaceAll('\n', '<br>');
t = t.replace(
/#\w*/gm,
/#\p{L}*/u,
(match) =>
`<a class="hover:text-blue-200 text-blue-400" href="/htag/${match.replace('#', '')}">${match}</a>`
);

View File

@@ -0,0 +1,22 @@
import { apiBase } from '@/stores/url';
import { sesionStore } from '@/stores/usuario';
import { get } from 'svelte/store';
export async function obtenerCantidadDeUsosdeHtag(htag: string) {
if (!htag) return null;
try {
const req = await fetch(`${get(apiBase)}/api/posts/hashtag/${htag}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}
});
if (req.ok) {
let data = await req.json();
return data;
}
return null;
} catch {
return null;
}
}