mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-20 02:01:19 +00:00
Rebuild FP
This commit is contained in:
21
frontend/src/components/store/index.js
vendored
21
frontend/src/components/store/index.js
vendored
@@ -20,26 +20,32 @@
|
||||
|
||||
import Vue from 'vue'
|
||||
import Vuex, {createLogger} from 'vuex'
|
||||
import transactions_create from './modules/transactions/create';
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production'
|
||||
|
||||
export default new Vuex.Store(
|
||||
{
|
||||
modules: [],
|
||||
strict: true,
|
||||
plugins: [createLogger()],
|
||||
modules: {
|
||||
transactions: {
|
||||
namespaced: true,
|
||||
modules: {
|
||||
create: transactions_create
|
||||
}
|
||||
}
|
||||
},
|
||||
strict: debug,
|
||||
plugins: debug ? [createLogger()] : [],
|
||||
state: {
|
||||
currencyPreference: {},
|
||||
locale: 'en-US'
|
||||
},
|
||||
mutations: {
|
||||
setCurrencyPreference(state, object) {
|
||||
console.log('mutation: setCurrencyPreference');
|
||||
state.currencyPreference = object;
|
||||
},
|
||||
initialiseStore(state) {
|
||||
console.log('mutation: initialiseStore');
|
||||
// if locale in local storage:
|
||||
if (localStorage.locale) {
|
||||
state.locale = localStorage.locale;
|
||||
@@ -66,15 +72,12 @@ export default new Vuex.Store(
|
||||
},
|
||||
actions: {
|
||||
updateCurrencyPreference(context) {
|
||||
console.log('action: updateCurrencyPreference');
|
||||
if (localStorage.currencyPreference) {
|
||||
console.log('action: from local storage');
|
||||
context.commit('setCurrencyPreference', localStorage.currencyPreference);
|
||||
return;
|
||||
}
|
||||
axios.get('./api/v1/currencies/default')
|
||||
.then(response => {
|
||||
console.log('action: from axios');
|
||||
let currencyResponse = {
|
||||
id: parseInt(response.data.data.id),
|
||||
name: response.data.data.attributes.name,
|
||||
|
||||
Reference in New Issue
Block a user