This commit is contained in:
reya
2024-07-28 14:29:01 +07:00
parent 268c1af5b1
commit fe0864c0ee
16 changed files with 391 additions and 305 deletions

View File

@@ -75,19 +75,7 @@ export function getReceivers(tags: string[][]) {
return p;
}
export const useRelays = (id: string) =>
useQuery({
queryKey: ["relays", id],
queryFn: async () => {
const res = await commands.getInboxes(id);
if (res.status === "ok") {
return res.data;
} else {
throw new Error(res.error);
}
},
refetchOnWindowFocus: false,
refetchOnMount: false,
refetchOnReconnect: false,
});
export function getChatId(pubkey: string, tags: string[][]) {
const id = [pubkey, tags.map((tag) => tag[0] === "p" && tag[1])].join("-");
return id;
}