mirror of
https://github.com/lnbits/lnbits.git
synced 2025-03-17 21:31:55 +01:00
getting there
This commit is contained in:
parent
60ebbb7c73
commit
41c93ca47f
@ -1,39 +1,62 @@
|
|||||||
window.router = VueRouter.createRouter({
|
function loadScript(src) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = src;
|
||||||
|
script.async = true;
|
||||||
|
script.onload = resolve;
|
||||||
|
script.onerror = reject;
|
||||||
|
document.head.appendChild(script);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.router = VueRouter.createRouter({
|
||||||
history: VueRouter.createWebHistory(),
|
history: VueRouter.createWebHistory(),
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: '/wallet',
|
path: '/wallet',
|
||||||
name: 'Wallet',
|
name: 'Wallet',
|
||||||
component: {
|
component: {
|
||||||
template: '<div ref="content"></div>',
|
template: '<div ref="content"></div>',
|
||||||
async mounted() {
|
async mounted() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/wallet', {
|
// Fetch and inject the HTML
|
||||||
credentials: 'include',
|
const response = await fetch('/wallet', {
|
||||||
headers: {
|
credentials: 'include',
|
||||||
'Accept': 'text/html',
|
headers: {
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
'Accept': 'text/html',
|
||||||
}
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
})
|
},
|
||||||
const html = await response.text()
|
});
|
||||||
this.$refs.content.innerHTML = html
|
const html = await response.text();
|
||||||
this.$forceUpdate()
|
this.$refs.content.innerHTML = html;
|
||||||
} catch (error) {
|
|
||||||
console.error('Error loading wallet:', error)
|
// Dynamically load the wallet.js script
|
||||||
}
|
await loadScript('/static/js/wallet.js');
|
||||||
|
|
||||||
|
// Initialize the wallet app if necessary
|
||||||
|
if (window.app && typeof window.app.mount === 'function') {
|
||||||
|
window.app.mount(this.$refs.content); // Adjust the mount target if needed
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
this.$forceUpdate();
|
||||||
]
|
} catch (error) {
|
||||||
})
|
console.error('Error loading wallet:', error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
window.router.beforeEach((to, from, next) => {
|
window.router.beforeEach((to, from, next) => {
|
||||||
console.log('Route changing from', from.path, 'to', to.path)
|
console.log('Route changing from', from.path, 'to', to.path);
|
||||||
next()
|
next();
|
||||||
})
|
});
|
||||||
|
|
||||||
window.app.use(VueQrcodeReader)
|
// Initialize Vue app
|
||||||
window.app.use(Quasar)
|
window.app.use(VueQrcodeReader);
|
||||||
window.app.use(window.i18n)
|
window.app.use(Quasar);
|
||||||
window.app.use(window.router)
|
window.app.use(window.i18n);
|
||||||
window.app.mount('#vue')
|
window.app.use(window.router);
|
||||||
|
window.app.mount('#vue');
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user