From 861a53cf856db91fdb399c007485852d472f9a9c Mon Sep 17 00:00:00 2001 From: Mothana Date: Thu, 19 Sep 2024 03:06:40 +0400 Subject: [PATCH] fix --- src/Api/pub/autogenerated/ts/nostr_client.ts | 2 +- src/Pages/LinkedApp/index.tsx | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Api/pub/autogenerated/ts/nostr_client.ts b/src/Api/pub/autogenerated/ts/nostr_client.ts index 1f2878b8..cad1fdf5 100644 --- a/src/Api/pub/autogenerated/ts/nostr_client.ts +++ b/src/Api/pub/autogenerated/ts/nostr_client.ts @@ -1,6 +1,6 @@ // This file was autogenerated from a .proto file, DO NOT EDIT! import { NostrRequest } from './nostr_transport.js' -import * as Types from './types.js' +import * as Types from './types' export type ResultError = { status: 'ERROR', reason: string } export type NostrClientParams = { diff --git a/src/Pages/LinkedApp/index.tsx b/src/Pages/LinkedApp/index.tsx index 0b49d56d..937c3c4e 100644 --- a/src/Pages/LinkedApp/index.tsx +++ b/src/Pages/LinkedApp/index.tsx @@ -22,17 +22,23 @@ export const LinkedApp = () => { getNostrClient({ pubkey, relays }, source.keys).then(c => { c.GetDebitAuthorizations().then(res => { if (res.status === "OK") { - setDebitAuthorizations((state) => [...state, ...res.debits]) + setDebitAuthorizations((state) => [ + ...state, + ...res.debits.filter( + debit => !state.some(stateDebt => stateDebt.debit_id === debit.debit_id) + ) + ]) } }) }) }); - }, [nostrSpends, nodedUp, toggle, updatehook]) + }, [nostrSpends, nodedUp, updatehook]) useEffect(() => { if (!nodedUp) { return; } + console.log("inside") nostrSpends.forEach(source => { const { pubkey, relays } = parseNprofile(source.pasteField) getNostrClient({ pubkey, relays }, source.keys).then(c => { @@ -45,7 +51,7 @@ export const LinkedApp = () => { }) }) }); - }, [nostrSpends, nodedUp, toggle]) + }, [nostrSpends, nodedUp]) const authroizeRequest = useCallback(async (request: SourceDebitRequest) => { const res = await (await getNostrClient(request.source.pasteField, request.source.keys)).AuthorizeDebit({ authorize_npub: request.request.npub, rules: [] }); if (res.status !=="OK") {