render reply and sub reply accordingly

This commit is contained in:
Ren Amamiya
2023-07-19 17:07:25 +07:00
parent 22c1eaa541
commit 29d40ed406
14 changed files with 118 additions and 34 deletions

View File

@@ -16,6 +16,7 @@ export function useProfile(pubkey: string, fallback?: string) {
const current = Math.floor(Date.now() / 1000);
const cache = await getUserMetadata(pubkey);
if (cache && parseInt(cache.created_at) + 86400 >= current) {
console.log('cache hit - ', cache);
return cache;
} else {
const filter: NDKFilter = { kinds: [0], authors: [pubkey] };
@@ -24,6 +25,8 @@ export function useProfile(pubkey: string, fallback?: string) {
if (latest) {
await createMetadata(pubkey, pubkey, latest.content);
return JSON.parse(latest.content);
} else {
return null;
}
}
} else {