mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-26 13:36:15 +00:00
Fix account list and remove sanctum
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
import {api} from "../../../../boot/axios";
|
||||
import format from "date-fns/format";
|
||||
import {getCacheKey} from "../../../../support/get-cache-key.js";
|
||||
|
||||
export default class Get {
|
||||
|
||||
@@ -37,6 +38,31 @@ export default class Get {
|
||||
return api.get('/api/v1/accounts/' + identifier, {params: params});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param params
|
||||
* @returns {Promise<AxiosResponse<any>>}
|
||||
*/
|
||||
index(params) {
|
||||
// first, check API in some consistent manner.
|
||||
// then, load if necessary.
|
||||
const cacheKey = getCacheKey('/api/v1/accounts', params);
|
||||
const cacheValid = window.store.get('cacheValid');
|
||||
let cachedData = window.store.get(cacheKey);
|
||||
|
||||
if (cacheValid && typeof cachedData !== 'undefined') {
|
||||
console.log('Cache is valid, return cache.');
|
||||
return Promise.resolve(cachedData);
|
||||
}
|
||||
|
||||
// if not, store in cache and then return res.
|
||||
|
||||
return api.get('/api/v1/accounts', {params: params}).then(response => {
|
||||
console.log('Cache is invalid, return fresh.');
|
||||
window.store.set(cacheKey, response.data);
|
||||
return Promise.resolve({data: response.data.data, meta: response.data.meta});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -383,7 +383,8 @@ let index = function () {
|
||||
// one page only.o
|
||||
(new Get()).index(params).then(response => {
|
||||
console.log(response);
|
||||
this.totalPages = response.meta.lastPage;
|
||||
this.totalPages = response.meta.pagination.total_pages;
|
||||
console.log('a');
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
if (response.data.hasOwnProperty(i)) {
|
||||
let current = response.data[i];
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">
|
||||
<a :href="'{{ route('accounts.show', '') }}/' + account.id"
|
||||
<a :href="'{{ route('accounts.show', '0') }}/' + account.id"
|
||||
x-text="account.name"></a>
|
||||
|
||||
<span class="small">
|
||||
@@ -42,7 +42,7 @@
|
||||
<template x-if="group.transactions[0].type === 'transfer'">
|
||||
<span class="text-muted fa-solid fa-arrows-rotate fa-fw"></span>
|
||||
</template>
|
||||
<a :href="'{{route('transactions.show', '') }}/' + group.id" x-text="group.title"></a><br/></span>
|
||||
<a :href="'{{route('transactions.show', '0') }}/' + group.id" x-text="group.title"></a><br/></span>
|
||||
</template>
|
||||
<ul class="list-unstyled list-no-margin">
|
||||
<template x-for="transaction in group.transactions">
|
||||
@@ -61,7 +61,7 @@
|
||||
<template x-if="transaction.type == 'transfer'">
|
||||
<span class="text-muted fa-solid fa-arrows-rotate fa-fw"></span>
|
||||
</template>
|
||||
<a :href="'{{route('transactions.show', '') }}/' + group.id" x-text="transaction.description"></a>
|
||||
<a :href="'{{route('transactions.show', '0') }}/' + group.id" x-text="transaction.description"></a>
|
||||
</span>
|
||||
</template>
|
||||
</li>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<template x-for="bill in group.bills">
|
||||
<tr>
|
||||
<td>
|
||||
<a :href="'{{ route('subscriptions.show',['']) }}/' + bill.id" :title="bill.name">
|
||||
<a :href="'{{ route('subscriptions.show',['0']) }}/' + bill.id" :title="bill.name">
|
||||
<span x-text="bill.name"></span>
|
||||
</a>
|
||||
<template x-if="bill.paid">
|
||||
|
||||
Reference in New Issue
Block a user