Skip to content

Commit

Permalink
create reqbody manually
Browse files Browse the repository at this point in the history
  • Loading branch information
azuki774 committed Aug 13, 2024
1 parent e669864 commit 7002004
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 5 additions & 2 deletions components/History.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ const asyncData = await useAsyncData(
const data = asyncData.data.value as Record[];
// fetchデータを整形
for (let d of data) {
d.datetime = d.datetime.slice(0, 19); // 2023-09-23T00:00:00+09:00 -> 2023-09-23T00:00:00
if (data != undefined) { // 取得済の場合のみ
for (let d of data) {
d.datetime = d.datetime.slice(0, 19); // 2023-09-23T00:00:00+09:00 -> 2023-09-23T00:00:00
}
}
recordList.value = data
</script>
Expand Down
12 changes: 8 additions & 4 deletions server/api/postRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ export default defineEventHandler ( async (event) => {
const config = useRuntimeConfig()
const query = getQuery(event)
// create body
const reqbody = {
'category_id': query.category_id,
'price': query.price,
'from': "mawinter-fe"
const reqbody = `
{
"category_id":${query.category_id},
"price":${query.price},
"from":"mawinter-fe",
"memo":"手動"
}
`
console.log(reqbody)
const url = config.public.mawinterApi + "/v2/record"
const result = await $fetch(url,
{
Expand Down

0 comments on commit 7002004

Please sign in to comment.