|
| 1 | +/* eslint-disable */ |
| 2 | +/** |
| 3 | + * THIS FILE IS GENERATED AUTOMATICALLY. |
| 4 | + * DO NOT EDIT. |
| 5 | + * |
| 6 | + * You are probably looking on adding startup/initialization code. |
| 7 | + * Use "quasar new boot <name>" and add it there. |
| 8 | + * One boot file per concern. Then reference the file(s) in quasar.config.js > boot: |
| 9 | + * boot: ['file', ...] // do not add ".js" extension to it. |
| 10 | + * |
| 11 | + * Boot files are your "main.js" |
| 12 | + **/ |
| 13 | + |
| 14 | + |
| 15 | +import { createApp } from 'vue' |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +import '@quasar/extras/material-icons/material-icons.css' |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +// We load Quasar stylesheet file |
| 29 | +import 'quasar/dist/quasar.sass' |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +import 'src/css/app.scss' |
| 35 | + |
| 36 | + |
| 37 | +import createQuasarApp from './app.js' |
| 38 | +import quasarUserOptions from './quasar-user-options.js' |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +console.info('[Quasar] Running SPA.') |
| 46 | + |
| 47 | + |
| 48 | +const publicPath = `/` |
| 49 | + |
| 50 | +async function start ({ |
| 51 | + app, |
| 52 | + router |
| 53 | + , store |
| 54 | +}, bootFiles) { |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + let hasRedirected = false |
| 59 | + const getRedirectUrl = url => { |
| 60 | + try { return router.resolve(url).href } |
| 61 | + catch (err) {} |
| 62 | + |
| 63 | + return Object(url) === url |
| 64 | + ? null |
| 65 | + : url |
| 66 | + } |
| 67 | + const redirect = url => { |
| 68 | + hasRedirected = true |
| 69 | + |
| 70 | + if (typeof url === 'string' && /^https?:\/\//.test(url)) { |
| 71 | + window.location.href = url |
| 72 | + return |
| 73 | + } |
| 74 | + |
| 75 | + const href = getRedirectUrl(url) |
| 76 | + |
| 77 | + // continue if we didn't fail to resolve the url |
| 78 | + if (href !== null) { |
| 79 | + window.location.href = href |
| 80 | + |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + const urlPath = window.location.href.replace(window.location.origin, '') |
| 85 | + |
| 86 | + for (let i = 0; hasRedirected === false && i < bootFiles.length; i++) { |
| 87 | + try { |
| 88 | + await bootFiles[i]({ |
| 89 | + app, |
| 90 | + router, |
| 91 | + store, |
| 92 | + ssrContext: null, |
| 93 | + redirect, |
| 94 | + urlPath, |
| 95 | + publicPath |
| 96 | + }) |
| 97 | + } |
| 98 | + catch (err) { |
| 99 | + if (err && err.url) { |
| 100 | + redirect(err.url) |
| 101 | + return |
| 102 | + } |
| 103 | + |
| 104 | + console.error('[Quasar] boot error:', err) |
| 105 | + return |
| 106 | + } |
| 107 | + } |
| 108 | + |
| 109 | + if (hasRedirected === true) { |
| 110 | + return |
| 111 | + } |
| 112 | + |
| 113 | + |
| 114 | + app.use(router) |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + app.mount('#q-app') |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | +} |
| 130 | + |
| 131 | +createQuasarApp(createApp, quasarUserOptions) |
| 132 | + |
| 133 | + .then(app => { |
| 134 | + // eventually remove this when Cordova/Capacitor/Electron support becomes old |
| 135 | + const [ method, mapFn ] = Promise.allSettled !== void 0 |
| 136 | + ? [ |
| 137 | + 'allSettled', |
| 138 | + bootFiles => bootFiles.map(result => { |
| 139 | + if (result.status === 'rejected') { |
| 140 | + console.error('[Quasar] boot error:', result.reason) |
| 141 | + return |
| 142 | + } |
| 143 | + return result.value.default |
| 144 | + }) |
| 145 | + ] |
| 146 | + : [ |
| 147 | + 'all', |
| 148 | + bootFiles => bootFiles.map(entry => entry.default) |
| 149 | + ] |
| 150 | + |
| 151 | + return Promise[ method ]([ |
| 152 | + |
| 153 | + import('boot/axios'), |
| 154 | + |
| 155 | + import('boot/matomo'), |
| 156 | + |
| 157 | + import('boot/global-components') |
| 158 | + |
| 159 | + ]).then(bootFiles => { |
| 160 | + const boot = mapFn(bootFiles).filter(entry => typeof entry === 'function') |
| 161 | + start(app, boot) |
| 162 | + }) |
| 163 | + }) |
| 164 | + |
0 commit comments