clean up messy code

This commit is contained in:
Ren Amamiya
2023-09-18 09:50:15 +07:00
parent 13f5190ba1
commit 53aa13c8aa
31 changed files with 256 additions and 373 deletions

View File

@@ -25,6 +25,7 @@ export function useEvent(
authors: [naddr.pubkey],
});
const rEvent = [...rEvents].slice(-1)[0];
if (!rEvent) return Promise.reject(new Error('event not found'));
return rEvent;
}
@@ -40,7 +41,7 @@ export function useEvent(
// get event from relay if event in db not present
const event = await ndk.fetchEvent(id);
if (!event) throw new Error(`Event not found: ${id}`);
if (!event) return Promise.reject(new Error('event not found'));
const rawEvent = toRawEvent(event);
await db.createEvent(rawEvent);