mirror of
https://github.com/mokuappio/serverless-invoices.git
synced 2025-10-27 16:01:07 -04:00
No configuration setup. Wordpress compatible.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
// const wordpress = window.name ? JSON.parse(window.name) : { front_url: '', api_url: '', nonce: '' };
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
storageType: 'local'
|
storageType: 'local',
|
||||||
|
// locales_url: wordpress.front_url,
|
||||||
|
// api_url: wordpress.api_url,
|
||||||
|
// api_nonce: wordpress.nonce,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import VueI18Next from '@panter/vue-i18next';
|
|||||||
import Backend from 'i18next-http-backend';
|
import Backend from 'i18next-http-backend';
|
||||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||||
import app from '@/main';
|
import app from '@/main';
|
||||||
|
import config from '@/config/app.config';
|
||||||
|
|
||||||
Vue.use(VueI18Next);
|
Vue.use(VueI18Next);
|
||||||
|
|
||||||
@ -11,16 +12,11 @@ i18next
|
|||||||
.use(LanguageDetector)
|
.use(LanguageDetector)
|
||||||
.use(Backend);
|
.use(Backend);
|
||||||
|
|
||||||
const path = window.name
|
|
||||||
? JSON.parse(window.name).front_url
|
|
||||||
: `${window.location.origin}${process.env.BASE_URL}`;
|
|
||||||
|
|
||||||
|
|
||||||
const initialized = i18next.init({
|
const initialized = i18next.init({
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
whitelist: ['en', 'fr', 'et', 'fa', 'bn', 'es'],
|
whitelist: ['en', 'fr', 'et', 'fa', 'bn', 'es'],
|
||||||
backend: {
|
backend: {
|
||||||
loadPath: `${path}/locales/{{lng}}/{{ns}}.json`,
|
loadPath: config.locales_url || `${window.location.origin}${process.env.BASE_URL}/locales/{{lng}}/{{ns}}.json`,
|
||||||
},
|
},
|
||||||
detection: {
|
detection: {
|
||||||
order: ['querystring', 'path', 'localStorage', 'navigator'],
|
order: ['querystring', 'path', 'localStorage', 'navigator'],
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import app from '@/main';
|
import app from '@/main';
|
||||||
|
import config from '@/config/app.config';
|
||||||
import NotificationService from '@/services/notification.service';
|
import NotificationService from '@/services/notification.service';
|
||||||
import { removeVuexORMFlags } from '@/utils/helpers';
|
import { removeVuexORMFlags } from '@/utils/helpers';
|
||||||
|
|
||||||
const config = window.name ? JSON.parse(window.name) : { front_url: '', api_url: '', nonce: '' };
|
|
||||||
|
|
||||||
const http = axios.create({
|
const http = axios.create({
|
||||||
baseURL: config.api_url,
|
baseURL: config.api_url || '',
|
||||||
headers: {
|
headers: {
|
||||||
'X-WP-Nonce': config.nonce,
|
'X-WP-Nonce': config.nonce || '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -7,11 +7,13 @@ class DataService {
|
|||||||
adapter = null;
|
adapter = null;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (config.storageType === 'local') {
|
const type = config.storageType || 'local';
|
||||||
|
|
||||||
|
if (type === 'local') {
|
||||||
this.adapter = local;
|
this.adapter = local;
|
||||||
} else if (config.storageType === 'http') {
|
} else if (type === 'http') {
|
||||||
this.adapter = http;
|
this.adapter = http;
|
||||||
} else if (config.storageType === 'wordpress') {
|
} else if (type === 'wordpress') {
|
||||||
this.adapter = wordpress;
|
this.adapter = wordpress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user