mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-23 04:46:44 +00:00
Frontend updates
This commit is contained in:
@@ -25,47 +25,49 @@
|
||||
import {defineComponent} from 'vue';
|
||||
import Preferences from "./api/preferences";
|
||||
import Currencies from "./api/currencies";
|
||||
import {setDatesFromViewRange} from "./store/fireflyiii/actions";
|
||||
import {useFireflyIIIStore} from 'stores/fireflyiii'
|
||||
|
||||
|
||||
export default defineComponent(
|
||||
{
|
||||
name: 'App',
|
||||
preFetch({store}) {
|
||||
const ffStore = useFireflyIIIStore(store);
|
||||
|
||||
store.dispatch('fireflyiii/refreshCacheKey');
|
||||
ffStore.refreshCacheKey();
|
||||
|
||||
const getViewRange = function() {
|
||||
const getViewRange = function () {
|
||||
let pref = new Preferences();
|
||||
return pref.getByName('viewRange').then(data => {
|
||||
return pref.getByName('viewRange').then(data => {
|
||||
|
||||
const viewRange = data.data.data.attributes.data;
|
||||
store.commit('fireflyiii/updateViewRange', viewRange);
|
||||
store.dispatch('fireflyiii/setDatesFromViewRange');
|
||||
ffStore.updateViewRange(viewRange);
|
||||
ffStore.setDatesFromViewRange();
|
||||
}).catch((err) => {
|
||||
console.error('Could not load view range.')
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
|
||||
const getListPageSize = function() {
|
||||
const getListPageSize = function () {
|
||||
let pref = new Preferences();
|
||||
return pref.getByName('listPageSize').then(data => {
|
||||
return pref.getByName('listPageSize').then(data => {
|
||||
|
||||
const listPageSize = data.data.data.attributes.data;
|
||||
store.commit('fireflyiii/updateListPageSize', listPageSize);
|
||||
ffStore.updateListPageSize(listPageSize);
|
||||
}).catch((err) => {
|
||||
console.error('Could not load listPageSize.')
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
|
||||
const getDefaultCurrency = function() {
|
||||
const getDefaultCurrency = function () {
|
||||
let curr = new Currencies();
|
||||
return curr.default().then(data => {
|
||||
return curr.default().then(data => {
|
||||
let currencyId = parseInt(data.data.data.id);
|
||||
let currencyCode = data.data.data.attributes.code;
|
||||
store.commit('fireflyiii/setCurrencyId', currencyId);
|
||||
store.commit('fireflyiii/setCurrencyCode', currencyCode);
|
||||
ffStore.setCurrencyId(currencyId);
|
||||
ffStore.setCurrencyCode(currencyCode);
|
||||
}).catch((err) => {
|
||||
console.error('Could not load preferences.');
|
||||
console.log(err);
|
||||
|
Reference in New Issue
Block a user