feat: get last goal

This commit is contained in:
Alejandro Gomez 2023-07-06 21:04:02 +02:00
parent 0c8054949f
commit ad2f4bf620
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817

View File

@ -27,5 +27,12 @@ export function useZapGoal(link: NostrLink, leaveOpen = false) {
sub
);
return data?.at(0);
const sorted = useMemo(() => {
const s = (data ? [...data] : []).sort(
(a: NostrEvent, b: NostrEvent) => b.created_at - a.created_at
);
return s;
}, [data]);
return sorted.at(0);
}