mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-07 14:10:43 -03:00
arrelgado tema de pagina de htags
This commit is contained in:
@@ -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>`
|
||||
);
|
||||
|
||||
22
src/lib/hooks/obtenerCantidadDeUsosdeHtag.ts
Normal file
22
src/lib/hooks/obtenerCantidadDeUsosdeHtag.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user