mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-19 17:51:19 +00:00
Rebuild front
This commit is contained in:
24
frontend/src/components/store/modules/root.js
vendored
24
frontend/src/components/store/modules/root.js
vendored
@@ -49,20 +49,20 @@ const getters = {
|
||||
const actions = {
|
||||
initialiseStore(context) {
|
||||
// cache key auto refreshes every day
|
||||
console.log('Now in initialize store.')
|
||||
// console.log('Now in initialize store.')
|
||||
if (localStorage.cacheKey) {
|
||||
console.log('Storage has cache key: ');
|
||||
console.log(localStorage.cacheKey);
|
||||
// console.log('Storage has cache key: ');
|
||||
// console.log(localStorage.cacheKey);
|
||||
let object = JSON.parse(localStorage.cacheKey);
|
||||
if (Date.now() - object.age > 86400000) {
|
||||
console.log('Key is here but is old.');
|
||||
// console.log('Key is here but is old.');
|
||||
context.commit('refreshCacheKey');
|
||||
} else {
|
||||
console.log('Cache key from local storage: ' + object.value);
|
||||
// console.log('Cache key from local storage: ' + object.value);
|
||||
context.commit('setCacheKey', object);
|
||||
}
|
||||
} else {
|
||||
console.log('No key need new one.');
|
||||
// console.log('No key need new one.');
|
||||
context.commit('refreshCacheKey');
|
||||
}
|
||||
if (localStorage.listPageSize) {
|
||||
@@ -98,16 +98,16 @@ const mutations = {
|
||||
let N = 8;
|
||||
let cacheKey = Array(N+1).join((Math.random().toString(36)+'00000000000000000').slice(2, 18)).slice(0, N);
|
||||
let object = {age: age, value: cacheKey};
|
||||
console.log('Store new key in string JSON');
|
||||
console.log(JSON.stringify(object));
|
||||
// console.log('Store new key in string JSON');
|
||||
// console.log(JSON.stringify(object));
|
||||
localStorage.cacheKey = JSON.stringify(object);
|
||||
state.cacheKey = {age: age, value: cacheKey};
|
||||
console.log('Refresh: cachekey is now ' + cacheKey);
|
||||
// console.log('Refresh: cachekey is now ' + cacheKey);
|
||||
},
|
||||
setCacheKey(state, payload) {
|
||||
console.log('Stored cache key in localstorage.');
|
||||
console.log(payload);
|
||||
console.log(JSON.stringify(payload));
|
||||
// console.log('Stored cache key in localstorage.');
|
||||
// console.log(payload);
|
||||
// console.log(JSON.stringify(payload));
|
||||
localStorage.cacheKey = JSON.stringify(payload);
|
||||
state.cacheKey = payload;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user