Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
boot code
James Coled1e1314dcf15
diff --git a/frontend/src/boot/.gitkeep b/frontend/src/boot/.gitkeepnew file mode 100644index 0000000000..e69de29bb2diff --git a/frontend/src/boot/axios.js b/frontend/src/boot/axios.jsnew file mode 100644index 0000000000..b5067a1205--- /dev/null+++ b/frontend/src/boot/axios.js@@ -0,0 +1,34 @@+import {boot} from 'quasar/wrappers'+import axios from 'axios'+import {setupCache} from 'axios-cache-adapter'++const cache = setupCache({+ maxAge: 15 * 60 * 1000,+ exclude: { query: false }+ })++// Be careful when using SSR for cross-request state pollution+// due to creating a Singleton instance here;+// If any client changes this (global) instance, it might be a+// good idea to move this instance creation inside of the+// "export default () => {}" function below (which runs individually+// for each client)++const url = process.env.DEBUGGING ? 'https://firefly.sd.home' : '/';+const api = axios.create({baseURL: url, withCredentials: true, adapter: cache.adapter});++export default boot(({app}) => {+ // for use inside Vue files (Options API) through this.$axios and this.$api+ axios.defaults.withCredentials = true;+ axios.defaults.baseURL = url;++ app.config.globalProperties.$axios = axios+ // ^ ^ ^ this will allow you to use this.$axios (for Vue Options API form)+ // so you won't necessarily have to import axios in each vue file++ app.config.globalProperties.$api = api+ // ^ ^ ^ this will allow you to use this.$api (for Vue Options API form)+ // so you can easily perform requests against your app's API+})++export {api}diff --git a/frontend/src/boot/i18n.js b/frontend/src/boot/i18n.jsnew file mode 100644index 0000000000..bd1290d665--- /dev/null+++ b/frontend/src/boot/i18n.js@@ -0,0 +1,13 @@+import { boot } from 'quasar/wrappers'+import { createI18n } from 'vue-i18n'+import messages from 'src/i18n'++export default boot(({ app }) => {+ const i18n = createI18n({+ locale: 'en-US',+ messages+ })++ // Set i18n instance on app+ app.use(i18n)+})