accounting/frontend/components/app.vue

50 lines
886 B
Vue
Raw Normal View History

2024-01-16 15:13:04 +00:00
<template>
<div class="d-flex h-100">
<div
class="d-flex flex-column flex-shrink-0 p-3"
style="width: 300px"
>
<accounts-sidebar
:accounts="accounts"
@updateAccounts="fetchAccounts"
/>
</div>
2024-01-16 16:30:17 +00:00
<div class="d-flex flex-column flex-grow-1 py-3">
2024-01-17 22:02:41 +00:00
<router-view
:accounts="accounts"
@updateAccounts="fetchAccounts"
/>
2024-01-16 15:13:04 +00:00
</div>
</div>
</template>
<script>
import accountsSidebar from './accountsSidebar.vue'
export default {
components: { accountsSidebar },
created() {
this.fetchAccounts()
},
data() {
return {
accounts: [],
}
},
methods: {
fetchAccounts() {
return fetch('/api/accounts?with-balances')
.then(resp => resp.json())
.then(data => {
this.accounts = data
})
},
},
name: 'AccountingAppMain',
}
</script>