fix: filter goals by host

This commit is contained in:
Alejandro Gomez
2023-07-06 21:46:59 +02:00
parent 85db515124
commit 986b44b7b6
3 changed files with 9 additions and 4 deletions

View File

@ -11,15 +11,16 @@ import { GOAL } from "const";
import { System } from "index";
import { findTag } from "utils";
export function useZapGoal(link: NostrLink, leaveOpen = false) {
export function useZapGoal(host: string, link: NostrLink, leaveOpen = false) {
const sub = useMemo(() => {
const b = new RequestBuilder(`goals:${link.author!.slice(0, 12)}`);
const b = new RequestBuilder(`goals:${host.slice(0, 12)}`);
b.withOptions({ leaveOpen });
b.withFilter()
.kinds([GOAL])
.authors([host])
.tag("a", [`${link.kind}:${link.author!}:${link.id}`]);
return b;
}, [link]);
}, [link, leaveOpen]);
const { data } = useRequestBuilder<NoteCollection>(
System,