Skip to content

Commit

Permalink
Use Parameter for summary page FY
Browse files Browse the repository at this point in the history
  • Loading branch information
azuki774 committed Sep 10, 2024
1 parent eafdef9 commit a876c26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion pages/summary/[year].vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ const AllSumList = ref<SummaryOne>() // 合計フィールド
const AllSumWithoutInvestList = ref<SummaryOne>() // 合計(投資除く)フィールド
let fetched: boolean // api fetch 出来ていたら true にする(表示制御用)
const route = useRoute()
const year = route.params.year
const asyncData = await useFetch(
'/api/summary',
'/api/summary' + '?year=' + year, // webサーバ内ではクエリパラメータで渡す
{
key: `/api/summary`,
transform: (data: SummaryOne[]): SummaryOne[][] => {
Expand Down
5 changes: 3 additions & 2 deletions server/api/summary.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export default defineEventHandler (async () => {
export default defineEventHandler (async (event) => {
const config = useRuntimeConfig()
const url = config.public.mawinterApi + '/v2/record/summary/2024'
const query = getQuery(event)
const url = config.public.mawinterApi + '/v2/record/summary/' + query.year
const result = await $fetch(url,
{
method: 'GET',
Expand Down

0 comments on commit a876c26

Please sign in to comment.