Rebuild + some placeholders.

This commit is contained in:
James Cole 2021-06-19 13:39:40 +02:00
parent 3e31752a8f
commit 1f176c93d5
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
24 changed files with 72 additions and 67 deletions

View File

@ -261,23 +261,23 @@ export default {
this.ready = true; this.ready = true;
// make object thing: // make object thing:
let token = document.head.querySelector('meta[name="csrf-token"]'); // let token = document.head.querySelector('meta[name="csrf-token"]');
this.api = setup( // this.api = setup(
{ // {
// `axios` options // // `axios` options
//baseURL: './', // //baseURL: './',
headers: {'X-CSRF-TOKEN': token.content, 'X-James': 'yes'}, // headers: {'X-CSRF-TOKEN': token.content, 'X-James': 'yes'},
//
// `axios-cache-adapter` options // // `axios-cache-adapter` options
cache: { // cache: {
maxAge: 15 * 60 * 1000, // maxAge: 15 * 60 * 1000,
readHeaders: false, // readHeaders: false,
exclude: { // exclude: {
query: false, // query: false,
}, // },
debug: true // debug: true
} // }
}); // });
}, },
methods: { methods: {

View File

@ -46,7 +46,7 @@
></b-pagination> ></b-pagination>
</div> </div>
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12"> <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
(refresh) <button @click="newCacheKey" class="btn btn-sm float-right btn-info"><span class="fas fa-sync"></span></button>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -136,14 +136,13 @@
<div class="card-footer"> <div class="card-footer">
<a :href="'./transactions/create/' + type" class="btn btn-success" <a :href="'./transactions/create/' + type" class="btn btn-success"
:title="$t('firefly.create_new_transaction')">{{ $t('firefly.create_new_transaction') }}</a> :title="$t('firefly.create_new_transaction')">{{ $t('firefly.create_new_transaction') }}</a>
<a href="#" class="btn btn-info"><span class="fas fa-sync"></span></a>
</div> </div>
</div> </div>
</div> </div>
<div class="col-lg-4"> <div class="col-lg-4">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
Box previous period Box previous periods
</div> </div>
</div> </div>
</div> </div>
@ -158,7 +157,7 @@
></b-pagination> ></b-pagination>
</div> </div>
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12"> <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
(refresh) <button @click="newCacheKey" class="btn btn-sm float-right btn-info"><span class="fas fa-sync"></span></button>
</div> </div>
</div> </div>
</div> </div>
@ -166,9 +165,8 @@
<script> <script>
import {mapGetters} from "vuex"; import {mapGetters, mapMutations} from "vuex";
import format from "date-fns/format"; import format from "date-fns/format";
import {setup} from 'axios-cache-adapter';
import {configureAxios} from "../../shared/forageStore"; import {configureAxios} from "../../shared/forageStore";
export default { export default {
@ -211,7 +209,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters('root', ['listPageSize']), ...mapGetters('root', ['listPageSize', 'cacheKey']),
...mapGetters('dashboard/index', ['start', 'end',]), ...mapGetters('dashboard/index', ['start', 'end',]),
'indexReady': function () { 'indexReady': function () {
return null !== this.start && null !== this.end && null !== this.listPageSize && this.ready; return null !== this.start && null !== this.end && null !== this.listPageSize && this.ready;
@ -233,25 +231,26 @@ export default {
this.ready = true; this.ready = true;
// make object thing: // make object thing:
let token = document.head.querySelector('meta[name="csrf-token"]'); // let token = document.head.querySelector('meta[name="csrf-token"]');
this.api = setup( // this.api = setup(
{ // {
// `axios` options // // `axios` options
//baseURL: './', // //baseURL: './',
headers: {'X-CSRF-TOKEN': token.content, 'X-James': 'yes'}, // headers: {'X-CSRF-TOKEN': token.content, 'X-James': 'yes'},
//
// `axios-cache-adapter` options // // `axios-cache-adapter` options
cache: { // cache: {
maxAge: 15 * 60 * 1000, // maxAge: 15 * 60 * 1000,
readHeaders: false, // readHeaders: false,
exclude: { // exclude: {
query: false, // query: false,
}, // },
debug: true // debug: true
} // }
}); // });
}, },
methods: { methods: {
...mapMutations('root', ['refreshCacheKey',]),
updateFieldList: function () { updateFieldList: function () {
this.fields = [ this.fields = [
{key: 'type', label: ' ', sortable: false}, {key: 'type', label: ' ', sortable: false},
@ -264,6 +263,12 @@ export default {
{key: 'menu', label: ' ', sortable: false}, {key: 'menu', label: ' ', sortable: false},
]; ];
}, },
newCacheKey: function () {
this.refreshCacheKey();
this.downloaded = false;
this.accounts = [];
this.getTransactionList();
},
getTransactionList: function () { getTransactionList: function () {
console.log('getTransactionList()'); console.log('getTransactionList()');
if (this.indexReady && !this.loading && !this.downloaded) { if (this.indexReady && !this.loading && !this.downloaded) {
@ -280,7 +285,7 @@ export default {
configureAxios().then(async (api) => { configureAxios().then(async (api) => {
let startStr = format(this.start, 'y-MM-dd'); let startStr = format(this.start, 'y-MM-dd');
let endStr = format(this.end, 'y-MM-dd'); let endStr = format(this.end, 'y-MM-dd');
api.get('./api/v1/transactions?type=' + this.type + '&page=' + page + "&start=" + startStr + "&end=" + endStr) api.get('./api/v1/transactions?type=' + this.type + '&page=' + page + "&start=" + startStr + "&end=" + endStr + '&cache=' + this.cacheKey)
.then(response => { .then(response => {
//let currentPage = parseInt(response.data.meta.pagination.current_page); //let currentPage = parseInt(response.data.meta.pagination.current_page);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long