File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
packages/invoice-dashboard/src/lib Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 3333 export let requestNetwork: RequestNetwork | null | undefined ;
3434 export let request: Types .IRequestDataWithEvents | undefined ;
3535 export let currencyManager: any ;
36+ export let isRequestPayed: boolean ;
3637
3738 let network = request ?.currencyInfo ?.network || " mainnet" ;
3839 let currency = currencyManager .fromAddress (request ?.currencyInfo ?.value );
140141 isPaid = true ;
141142 loading = false ;
142143 statuses = [];
144+ isRequestPayed = true ;
143145 } catch (err ) {
144146 console .error (" Something went wrong while paying : " , err );
145147 loading = false ;
Original file line number Diff line number Diff line change 4646 let loading = false ;
4747 let searchQuery = " " ;
4848 let debouncedUpdate: any ;
49+ let isRequestPayed = false ;
4950 let currentTab = " All" ;
5051 let requests: Types .IRequestDataWithEvents [] | undefined = [];
5152 let activeRequest: Types .IRequestDataWithEvents | undefined ;
6768 signer = wallet ?.accounts [0 ]?.address ;
6869 }
6970
71+ $ : isRequestPayed , getOneRequest (activeRequest );
72+
7073 onMount (() => {
7174 currencyManager = initializeCurrencyManager (currencies );
7275 });
9093 }
9194 };
9295
96+ const getOneRequest = async (activeRequest : any ) => {
97+ try {
98+ loading = true ;
99+
100+ const _request = await requestNetwork ?.fromRequestId (
101+ activeRequest ?.requestId !
102+ );
103+
104+ requests = requests ?.filter (
105+ (request ) => request .requestId !== activeRequest .requestId
106+ );
107+ requests = [... requests , _request .getData ()].sort (
108+ (a , b ) => b .timestamp - a .timestamp
109+ );
110+
111+ loading = false ;
112+ } catch (error ) {
113+ loading = false ;
114+ console .error (" Failed to fetch request:" , error );
115+ }
116+ };
117+
93118 $ : {
94119 if (requests && loading ) {
95120 loading = false ;
471496 {#if activeRequest !== undefined }
472497 <InvoiceView
473498 {wallet }
499+ bind:isRequestPayed
474500 {requestNetwork }
475501 {currencyManager }
476502 config ={activeConfig }
You can’t perform that action at this time.
0 commit comments