aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/socket.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/socket.js')
-rw-r--r--src/lib/socket.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/socket.js b/src/lib/socket.js
index 02d73a48..b385db9d 100644
--- a/src/lib/socket.js
+++ b/src/lib/socket.js
@@ -1,9 +1,10 @@
import { get } from 'svelte/store';
-import { invoices, newPayment, rate } from '$lib/store';
+import { invoices, newPayment, rate, user } from '$lib/store';
import { success } from '$lib/utils';
import { env } from '$env/dynamic/public';
const socketUrl = env.PUBLIC_SOCKET;
+const btc = env.PUBLIC_BTC;
let interval, socket, token;
@@ -18,12 +19,14 @@ export const messages = (data) => ({
rate.set(data);
},
- payment() {
+ async payment() {
let { amount, invoice } = data;
- console.log('INVOICE', invoice);
+ if (get(user).account_id !== data.account_id) return;
+
if (invoice) {
invoices.set({ ...get(invoices), [invoice.uuid]: invoice });
}
+
newPayment.set(true);
if (amount > 0) {
success(`Received ${amount} sats!`);