fix: bind window.fetch at boot so lnurlcash-kit transport works in browsers

This commit is contained in:
2026-08-19 21:36:48 +02:00
parent 1fe1453745
commit 1839700215
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ export default defineConfig((ctx) => {
// app boot file (/src/boot) // app boot file (/src/boot)
// --> boot files are part of "main.js" // --> boot files are part of "main.js"
// https://v2.quasar.dev/quasar-cli-vite/boot-files // https://v2.quasar.dev/quasar-cli-vite/boot-files
boot: ['i18n', 'wallet'], boot: ['i18n', 'kit-fetch', 'wallet'],
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-file#css // https://v2.quasar.dev/quasar-cli-vite/quasar-config-file#css
css: ['app.scss'], css: ['app.scss'],
+14
View File
@@ -0,0 +1,14 @@
import { defineBoot } from '#q-app';
// lnurlcash-kit's transport resolves its fetch as `options.fetch ??
// globalThis.fetch` and then invokes it as a method on the options object.
// In a browser, calling window.fetch with any receiver other than window
// throws a synchronous "Illegal invocation" TypeError - before any request
// is even attempted (Node's fetch has no such receiver check, so the unit
// tests never see it; every kit network call failed in real browsers).
// Binding the global once here means the kit's captured default is already
// bound, whichever receiver it is invoked with. Remove once lnurlcash-kit
// fixes this upstream in its transport (resolveOptions).
export default defineBoot(() => {
window.fetch = window.fetch.bind(window);
});