mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
feat(webln.js): add getInfo functionality and improve logging
This commit is contained in:
@@ -3,17 +3,23 @@ import {requestProvider} from "webln";
|
|||||||
export default (livewireComponent) => ({
|
export default (livewireComponent) => ({
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
console.log('WeBLN initialized');
|
console.log('WebLN initialized');
|
||||||
|
|
||||||
let webln;
|
let webln;
|
||||||
try {
|
try {
|
||||||
webln = await requestProvider();
|
webln = await requestProvider();
|
||||||
console.log('WeBLN provider acquired');
|
console.log('WebLN provider acquired');
|
||||||
this.$wire.call('logThis', 'WeBLN provider acquired');
|
this.$wire.call('logThis', 'WebLN provider acquired');
|
||||||
|
|
||||||
|
// getInfo
|
||||||
|
const info = await webln.getInfo();
|
||||||
|
console.log('WebLN getInfo:', info);
|
||||||
|
this.$wire.call('logThis', 'WebLN getInfo: ' + JSON.stringify(info));
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Handle users without WebLN
|
// Handle users without WebLN
|
||||||
console.error('WeBLN provider request failed:', err);
|
console.error('WebLN provider request failed:', err);
|
||||||
this.$wire.call('logThis', 'WeBLN provider request failed: ' + err);
|
this.$wire.call('logThis', 'WebLN provider request failed: ' + err);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user