mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 15:18:05 +00:00
Frontend remembers state.
This commit is contained in:
@@ -18,13 +18,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
let date = new Date;
|
||||
|
||||
const lodashClonedeep = require('lodash.clonedeep');
|
||||
|
||||
// initial state
|
||||
const state = () => ({
|
||||
transactionType: 'any',
|
||||
date: new Date,
|
||||
transactions: [],
|
||||
allowedOpposingTypes: {},
|
||||
accountToTransaction: {},
|
||||
@@ -41,8 +40,6 @@ const state = () => ({
|
||||
defaultTransaction: {
|
||||
// basic
|
||||
description: '',
|
||||
date: date.toISOString().split('T')[0],
|
||||
time: ('0' + date.getHours()).slice(-2) + ':' + ('0' + date.getMinutes()).slice(-2) + ':' + ('0' + date.getSeconds()).slice(-2),
|
||||
|
||||
// accounts:
|
||||
source_account: {
|
||||
@@ -99,6 +96,9 @@ const getters = {
|
||||
transactions: state => {
|
||||
return state.transactions;
|
||||
},
|
||||
date: state => {
|
||||
return state.date;
|
||||
},
|
||||
transactionType: state => {
|
||||
return state.transactionType;
|
||||
},
|
||||
@@ -176,6 +176,9 @@ const mutations = {
|
||||
let newTransaction = lodashClonedeep(state.defaultTransaction);
|
||||
state.transactions.push(newTransaction);
|
||||
},
|
||||
setDate(state, payload) {
|
||||
state.date = payload.date;
|
||||
},
|
||||
setCustomDateFields(state, payload) {
|
||||
state.customDateFields = payload;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user