Router and store

This commit is contained in:
James Cole 2022-02-27 10:14:26 +01:00
parent 3a49af94d0
commit cddfa3a8d2
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
14 changed files with 1283 additions and 0 deletions

30
frontend/src/router/index.js vendored Normal file
View File

@ -0,0 +1,30 @@
import { route } from 'quasar/wrappers'
import { createRouter, createMemoryHistory, createWebHistory, createWebHashHistory } from 'vue-router'
import routes from './routes'
/*
* If not building with SSR mode, you can
* directly export the Router instantiation;
*
* The function below can be async too; either use
* async/await or return a Promise which resolves
* with the Router instance.
*/
export default route(function (/* { store, ssrContext } */) {
const createHistory = process.env.SERVER
? createMemoryHistory
: (process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory)
const Router = createRouter({
scrollBehavior: () => ({ left: 0, top: 0 }),
routes,
// Leave this as is and make changes in quasar.conf.js instead!
// quasar.conf.js -> build -> vueRouterMode
// quasar.conf.js -> build -> publicPath
history: createHistory(process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE)
})
return Router
})

953
frontend/src/router/routes.js vendored Normal file
View File

@ -0,0 +1,953 @@
const routes = [
{
path: '/',
component: () => import('layouts/MainLayout.vue'),
children: [{
path: '',
component: () => import('pages/Index.vue'),
name: 'index',
meta: {dateSelector: true, pageTitle: 'firefly.welcome_back',}
}]
},
// beta
{
path: '/development',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/development/Index.vue'),
name: 'development.index',
meta: {
pageTitle: 'firefly.development'
}
}
]
},
// beta
{
path: '/export',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/export/Index.vue'),
name: 'export.index',
meta: {
pageTitle: 'firefly.export'
}
}
]
},
// budgets
{
path: '/budgets',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/budgets/Index.vue'),
name: 'budgets.index',
meta: {
pageTitle: 'firefly.budgets',
breadcrumbs: [
{title: 'budgets', route: 'budgets.index', params: []}
]
}
}
]
},
{
path: '/budgets/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/budgets/Show.vue'),
name: 'budgets.show',
meta: {
pageTitle: 'firefly.budgets',
breadcrumbs: [
{title: 'placeholder', route: 'budgets.show', params: []}
]
}
}
]
},
{
path: '/budgets/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/budgets/Edit.vue'),
name: 'budgets.edit',
meta: {
pageTitle: 'firefly.budgets',
breadcrumbs: [
{title: 'placeholder', route: 'budgets.show', params: []}
]
}
}
]
},
{
path: '/budgets/create',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/budgets/Create.vue'),
name: 'budgets.create',
meta: {
pageTitle: 'firefly.budgets',
breadcrumbs: [
{title: 'placeholder', route: 'budgets.show', params: []}
]
}
}
]
},
// subscriptions
{
path: '/subscriptions',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/subscriptions/Index.vue'),
name: 'subscriptions.index',
meta: {
pageTitle: 'firefly.subscriptions',
breadcrumbs: [{title: 'placeholder', route: 'subscriptions.index', params: []}]
}
}
]
},
{
path: '/subscriptions/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/subscriptions/Show.vue'),
name: 'subscriptions.show',
meta: {
pageTitle: 'firefly.subscriptions',
breadcrumbs: [
{title: 'placeholder', route: 'subscriptions.index'},
]
}
}
]
},
{
path: '/subscriptions/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/subscriptions/Edit.vue'),
name: 'subscriptions.edit',
meta: {
pageTitle: 'firefly.subscriptions',
breadcrumbs: [
{title: 'placeholder', route: 'subscriptions.index'},
]
}
}
]
},
{
path: '/subscriptions/create',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/subscriptions/Create.vue'),
name: 'subscriptions.create',
meta: {
dateSelector: false,
pageTitle: 'firefly.subscriptions',
}
}
]
},
// piggy banks
{
path: '/piggy-banks',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/piggy-banks/Index.vue'),
name: 'piggy-banks.index',
meta: {
pageTitle: 'firefly.piggyBanks',
breadcrumbs: [{title: 'piggy-banks', route: 'piggy-banks.index', params: []}]
}
}
]
},
{
path: '/piggy-banks/create',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/piggy-banks/Create.vue'),
name: 'piggy-banks.create',
meta: {
pageTitle: 'firefly.piggy-banks',
breadcrumbs: [
{title: 'placeholder', route: 'piggy-banks.create', params: []}
]
}
}
]
},
{
path: '/piggy-banks/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/piggy-banks/Show.vue'),
name: 'piggy-banks.show',
meta: {
pageTitle: 'firefly.piggy-banks',
breadcrumbs: [
{title: 'placeholder', route: 'piggy-banks.index'},
]
}
}
]
},
{
path: '/piggy-banks/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/piggy-banks/Edit.vue'),
name: 'piggy-banks.edit',
meta: {
pageTitle: 'firefly.piggy-banks',
breadcrumbs: [
{title: 'placeholder', route: 'piggy-banks.index'},
]
}
}
]
},
// transactions (single)
{
path: '/transactions/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/transactions/Show.vue'),
name: 'transactions.show',
meta: {
pageTitle: 'firefly.transactions',
breadcrumbs: [
{title: 'placeholder', route: 'transactions.index', params: {type: 'todo'}},
{title: 'placeholder', route: 'transactions.show', params: []}
]
}
}
]
},
// transactions (create)
{
path: '/transactions/create/:type',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/transactions/Create.vue'),
name: 'transactions.create',
meta: {
dateSelector: false,
pageTitle: 'firefly.transactions',
}
}
]
},
// transactions (index)
{
path: '/transactions/:type',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/transactions/Index.vue'),
name: 'transactions.index',
meta: {
dateSelector: false,
pageTitle: 'firefly.transactions',
breadcrumbs: [
{title: 'transactions'},
]
}
}
]
},
{
path: '/transactions/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/transactions/Edit.vue'),
name: 'transactions.edit',
meta: {
pageTitle: 'firefly.transactions',
breadcrumbs: [
{title: 'placeholder', route: 'transactions.index', params: {type: 'todo'}},
{title: 'placeholder', route: 'transactions.show', params: []}
]
}
}
]
},
// rules
{
path: '/rules',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/rules/Index.vue'),
name: 'rules.index',
meta: {
pageTitle: 'firefly.rules',
}
}
]
},
{
path: '/rules/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/rules/Show.vue'),
name: 'rules.show',
meta: {
pageTitle: 'firefly.rules',
breadcrumbs: [
{title: 'placeholder', route: 'transactions.index', params: {type: 'todo'}},
{title: 'placeholder', route: 'transactions.show', params: []}
]
}
}
]
},
{
path: '/rules/create',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/rules/Create.vue'),
name: 'rules.create',
meta: {
pageTitle: 'firefly.rules',
breadcrumbs: [
{title: 'placeholder', route: 'transactions.index', params: {type: 'todo'}},
]
}
}
]
},
{
path: '/rules/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/rules/Edit.vue'),
name: 'rules.edit',
meta: {
pageTitle: 'firefly.rules',
breadcrumbs: [
{title: 'placeholder', route: 'rules.index', params: {type: 'todo'}},
]
}
}
]
},
{
path: '/rule-groups/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/rule-groups/Edit.vue'),
name: 'rule-groups.edit',
meta: {
pageTitle: 'firefly.rules',
breadcrumbs: [
{title: 'placeholder', route: 'transactions.index', params: {type: 'todo'}},
]
}
}
]
},
{
path: '/rule-groups/create',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/rule-groups/Create.vue'),
name: 'rule-groups.create',
meta: {
pageTitle: 'firefly.rule-groups',
breadcrumbs: [
{title: 'placeholder', route: 'transactions.index', params: {type: 'todo'}},
]
}
}
]
},
// recurring transactions
{
path: '/recurring',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/recurring/Index.vue'),
name: 'recurring.index',
meta: {
pageTitle: 'firefly.recurrences',
}
}
]
},
{
path: '/recurring/create',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/recurring/Create.vue'),
name: 'recurring.create',
meta: {
pageTitle: 'firefly.recurrences',
breadcrumbs: [
{title: 'placeholder', route: 'recurrences.create', params: []}
]
}
}
]
},
{
path: '/recurring/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/recurring/Show.vue'),
name: 'recurring.show',
meta: {
pageTitle: 'firefly.recurrences',
breadcrumbs: [
{title: 'placeholder', route: 'recurrences.index'},
]
}
}
]
},
{
path: '/recurring/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/recurring/Edit.vue'),
name: 'recurring.edit',
meta: {
pageTitle: 'firefly.recurrences',
breadcrumbs: [
{title: 'placeholder', route: 'recurrences.index'},
]
}
}
]
},
// accounts
// account (single)
{
path: '/accounts/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/accounts/Show.vue'),
name: 'accounts.show',
meta: {
pageTitle: 'firefly.accounts',
breadcrumbs: [
{title: 'placeholder', route: 'accounts.index', params: {type: 'todo'}},
{title: 'placeholder', route: 'accounts.show', params: []}
]
}
}
]
},
{
path: '/accounts/reconcile/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/accounts/Reconcile.vue'),
name: 'accounts.reconcile',
meta: {
pageTitle: 'firefly.accounts',
breadcrumbs: [
{title: 'placeholder', route: 'accounts.index', params: {type: 'todo'}},
{title: 'placeholder', route: 'accounts.reconcile', params: []}
]
}
}
]
},
{
path: '/accounts/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/accounts/Edit.vue'),
name: 'accounts.edit',
meta: {
pageTitle: 'firefly.accounts',
breadcrumbs: [
{title: 'placeholder', route: 'accounts.index', params: {type: 'todo'}},
{title: 'placeholder', route: 'accounts.edit', params: []}
]
}
}
]
},
{
path: '/accounts/:type',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/accounts/Index.vue'),
name: 'accounts.index',
meta: {
pageTitle: 'firefly.accounts',
}
}
]
},
{
path: '/accounts/create/:type',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/accounts/Create.vue'),
name: 'accounts.create',
meta: {
pageTitle: 'firefly.accounts',
}
}
]
},
// categories
{
path: '/categories',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/categories/Index.vue'),
name: 'categories.index',
meta: {
pageTitle: 'firefly.categories',
}
}
]
},
{
path: '/categories/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/categories/Show.vue'),
name: 'categories.show',
meta: {
pageTitle: 'firefly.categories',
breadcrumbs: [
{title: 'placeholder', route: 'categories.show', params: []}
]
}
}
]
},
{
path: '/categories/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/categories/Edit.vue'),
name: 'categories.edit',
meta: {
pageTitle: 'firefly.categories',
breadcrumbs: [
{title: 'placeholder', route: 'categories.show', params: []}
]
}
}
]
},
{
path: '/categories/create',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/categories/Create.vue'),
name: 'categories.create',
meta: {
pageTitle: 'firefly.categories',
breadcrumbs: [
{title: 'placeholder', route: 'categories.show', params: []}
]
}
}
]
},
// tags
{
path: '/tags',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/tags/Index.vue'),
name: 'tags.index',
meta: {
pageTitle: 'firefly.tags',
}
}
]
},
{
path: '/tags/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/tags/Show.vue'),
name: 'tags.show',
meta: {
pageTitle: 'firefly.tags',
breadcrumbs: [
{title: 'placeholder', route: 'tags.show', params: []}
]
}
}
]
},
// groups
{
path: '/groups',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/groups/Index.vue'),
name: 'groups.index',
meta: {
pageTitle: 'firefly.object_groups_page_title'
}
}
]
},
{
path: '/groups/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/groups/Show.vue'),
name: 'groups.show',
meta: {
pageTitle: 'firefly.groups',
breadcrumbs: [
{title: 'placeholder', route: 'groups.show', params: []}
]
}
}
]
},
{
path: '/groups/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/groups/Edit.vue'),
name: 'groups.edit',
meta: {
pageTitle: 'firefly.groups',
breadcrumbs: [
{title: 'placeholder', route: 'categories.show', params: []}
]
}
}
]
},
// reports
{
path: '/reports',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/reports/Index.vue'),
name: 'reports.index',
meta: {
pageTitle: 'firefly.reports'
}
}
]
},
{
path: '/report/default/:accounts/:start/:end',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/reports/Default.vue'),
name: 'reports.default',
meta: {
pageTitle: 'firefly.reports'
}
}
]
},
// webhooks
{
path: '/webhooks',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/webhooks/Index.vue'),
name: 'webhooks.index',
meta: {
pageTitle: 'firefly.webhooks'
}
}
]
},
{
path: '/webhooks/show/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/webhooks/Show.vue'),
name: 'webhooks.show',
meta: {
pageTitle: 'firefly.webhooks',
breadcrumbs: [
{title: 'placeholder', route: 'groups.show', params: []}
]
}
}
]
},
{
path: '/webhooks/edit/:id',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/webhooks/Edit.vue'),
name: 'webhooks.edit',
meta: {
pageTitle: 'firefly.webhooks',
breadcrumbs: [
{title: 'placeholder', route: 'groups.show', params: []}
]
}
}
]
},
{
path: '/webhooks/create',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/webhooks/Create.vue'),
name: 'webhooks.create',
meta: {
pageTitle: 'firefly.webhooks',
breadcrumbs: [
{title: 'placeholder', route: 'webhooks.show', params: []}
]
}
}
]
},
// currencies
{
path: '/currencies',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/currencies/Index.vue'),
name: 'currencies.index',
meta: {
pageTitle: 'firefly.currencies'
}
}
]
},
{
path: '/currencies/show/:code',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/currencies/Show.vue'),
name: 'currencies.show',
meta: {
pageTitle: 'firefly.currencies',
breadcrumbs: [
{title: 'placeholder', route: 'currencies.show', params: []}
]
}
}
]
},
{
path: '/currencies/edit/:code',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/currencies/Edit.vue'),
name: 'currencies.edit',
meta: {
pageTitle: 'firefly.currencies',
breadcrumbs: [
{title: 'placeholder', route: 'currencies.show', params: []}
]
}
}
]
},
{
path: '/currencies/create',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/currencies/Create.vue'),
name: 'currencies.create',
meta: {
pageTitle: 'firefly.currencies',
breadcrumbs: [
{title: 'placeholder', route: 'currencies.create', params: []}
]
}
}
]
},
// profile
{
path: '/profile',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/profile/Index.vue'),
name: 'profile.index',
meta: {
pageTitle: 'firefly.profile'
}
}
]
},
{
path: '/profile/data',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/profile/Data.vue'),
name: 'profile.data',
meta: {
pageTitle: 'firefly.profile_data'
}
}
]
},
// preferences
{
path: '/preferences',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/preferences/Index.vue'),
name: 'preferences.index',
meta: {
pageTitle: 'firefly.preferences'
}
}
]
},
// administration
{
path: '/admin',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
component: () => import('pages/admin/Index.vue'),
name: 'admin.index',
meta: {
pageTitle: 'firefly.administration'
}
}
]
},
// Always leave this as last one,
// but you can also remove it
{
path: '/:catchAll(.*)*',
component: () => import('pages/Error404.vue')
}
]
export default routes

112
frontend/src/store/fireflyiii/actions.js vendored Normal file
View File

@ -0,0 +1,112 @@
/*
export function someAction (context) {
}
*/
import {endOfDay, endOfMonth, endOfQuarter, endOfWeek, startOfDay, startOfMonth, startOfQuarter, startOfWeek, startOfYear, subDays} from "date-fns";
export function refreshCacheKey(context) {
let cacheKey = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 8);
context.commit('setCacheKey', cacheKey);
}
export function resetRange(context) {
let defaultRange = context.getters.getDefaultRange;
context.commit('setRange', defaultRange);
}
export function setDatesFromViewRange(context) {
let start;
let end;
let viewRange = context.getters.getViewRange;
let today = new Date;
switch (viewRange) {
case 'last365':
start = startOfDay(subDays(today, 365));
end = endOfDay(today);
break;
case 'last90':
start = startOfDay(subDays(today, 90));
end = endOfDay(today);
break;
case 'last30':
start = startOfDay(subDays(today, 30));
end = endOfDay(today);
break;
case 'last7':
start = startOfDay(subDays(today, 7));
end = endOfDay(today);
break;
case 'YTD':
start = startOfYear(today);
end = endOfDay(today);
break;
case 'QTD':
start = startOfQuarter(today);
end = endOfDay(today);
break;
case 'MTD':
start = startOfMonth(today);
end = endOfDay(today);
break;
case '1D':
// today:
start = startOfDay(today);
end = endOfDay(today);
break;
case '1W':
// this week:
start = startOfDay(startOfWeek(today, {weekStartsOn: 1}));
end = endOfDay(endOfWeek(today, {weekStartsOn: 1}));
break;
case '1M':
// this month:
start = startOfDay(startOfMonth(today));
end = endOfDay(endOfMonth(today));
break;
case '3M':
// this quarter
start = startOfDay(startOfQuarter(today));
end = endOfDay(endOfQuarter(today));
break;
case '6M':
// this half-year
if (today.getMonth() <= 5) {
start = new Date(today);
start.setMonth(0);
start.setDate(1);
start = startOfDay(start);
end = new Date(today);
end.setMonth(5);
end.setDate(30);
end = endOfDay(start);
}
if (today.getMonth() > 5) {
start = new Date(today);
start.setMonth(6);
start.setDate(1);
start = startOfDay(start);
end = new Date(today);
end.setMonth(11);
end.setDate(31);
end = endOfDay(start);
}
break;
case '1Y':
// this year
start = new Date(today);
start.setMonth(0);
start.setDate(1);
start = startOfDay(start);
end = new Date(today);
end.setMonth(11);
end.setDate(31);
end = endOfDay(end);
break;
}
context.commit('setRange', {start: start, end: end});
context.commit('setDefaultRange', {start: start, end: end});
}

View File

@ -0,0 +1,30 @@
/*
export function someGetter (state) {
}
*/
export function getViewRange(state) {
return state.viewRange;
}
export function getListPageSize(state) {
return state.listPageSize;
}
export function getCurrencyCode(state) {
return state.currencyCode;
}
export function getCurrencyId(state) {
return state.currencyId;
}
export function getRange(state) {
return state.range;
}
export function getDefaultRange(state) {
return state.defaultRange;
}
export function getCacheKey(state) {
return state.cacheKey;
}

12
frontend/src/store/fireflyiii/index.js vendored Normal file
View File

@ -0,0 +1,12 @@
import state from './state'
import * as getters from './getters'
import * as mutations from './mutations'
import * as actions from './actions'
export default {
namespaced: true,
state,
getters,
mutations,
actions
}

View File

@ -0,0 +1,31 @@
/*
export function someMutation (state) {
}
*/
export const updateViewRange = (state, viewRange) => {
state.viewRange = viewRange;
}
export const updateListPageSize = (state, value) => {
state.listPageSize = value;
}
export const setRange = (state, value) => {
state.range = value;
}
export const setDefaultRange = (state, value) => {
state.defaultRange = value;
}
export const setCurrencyCode = (state, value) => {
state.currencyCode = value;
}
export const setCurrencyId = (state, value) => {
state.currencyId = value;
}
export const setCacheKey = (state, value) => {
state.cacheKey = value;
}

18
frontend/src/store/fireflyiii/state.js vendored Normal file
View File

@ -0,0 +1,18 @@
export default function () {
return {
drawerState: true,
viewRange: '1M',
listPageSize: 10,
range: {
start: null,
end: null
},
defaultRange: {
start: null,
end: null
},
currencyCode: 'AAA',
currencyId: '0',
cacheKey: 'initial'
}
}

28
frontend/src/store/index.js vendored Normal file
View File

@ -0,0 +1,28 @@
import { store } from 'quasar/wrappers'
import { createStore } from 'vuex'
// import example from './module-example'
import fireflyiii from './fireflyiii'
/*
* If not building with SSR mode, you can
* directly export the Store instantiation;
*
* The function below can be async too; either use
* async/await or return a Promise which resolves
* with the Store instance.
*/
export default store(function (/* { ssrContext } */) {
const Store = createStore({
modules: {
// example
fireflyiii
},
// enable strict mode (adds overhead!)
// for dev mode and --debug builds only
strict: process.env.DEBUGGING
})
return Store
})

View File

@ -0,0 +1,11 @@
import { ActionTree } from 'vuex';
import { StateInterface } from '../index';
import { ExampleStateInterface } from './state';
const actions: ActionTree<ExampleStateInterface, StateInterface> = {
someAction (/* context */) {
// your code
}
};
export default actions;

View File

@ -0,0 +1,11 @@
import { GetterTree } from 'vuex';
import { StateInterface } from '../index';
import { ExampleStateInterface } from './state';
const getters: GetterTree<ExampleStateInterface, StateInterface> = {
someAction (/* context */) {
// your code
}
};
export default getters;

View File

@ -0,0 +1,16 @@
import { Module } from 'vuex';
import { StateInterface } from '../index';
import state, { ExampleStateInterface } from './state';
import actions from './actions';
import getters from './getters';
import mutations from './mutations';
const exampleModule: Module<ExampleStateInterface, StateInterface> = {
namespaced: true,
actions,
getters,
mutations,
state
};
export default exampleModule;

View File

@ -0,0 +1,10 @@
import { MutationTree } from 'vuex';
import { ExampleStateInterface } from './state';
const mutation: MutationTree<ExampleStateInterface> = {
someMutation (/* state: ExampleStateInterface */) {
// your code
}
};
export default mutation;

View File

@ -0,0 +1,11 @@
export interface ExampleStateInterface {
prop: boolean;
}
function state(): ExampleStateInterface {
return {
prop: false
}
};
export default state;

10
frontend/src/store/store-flag.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
/* eslint-disable */
// THIS FEATURE-FLAG FILE IS AUTOGENERATED,
// REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING
import "quasar/dist/types/feature-flag";
declare module "quasar/dist/types/feature-flag" {
interface QuasarFeatureFlags {
store: true;
}
}