This commit is contained in:
2025-07-13 02:46:13 +09:00
parent fdf242c060
commit 0c46cf28db
29 changed files with 509 additions and 456 deletions
+4 -3
View File
@@ -1,11 +1,11 @@
import axios from 'axios'
import React, { useEffect, useState } from 'react'
import { useState } from 'react'
import TextArea from '@/components/common/TextArea'
import { Button } from '@/components/ui/button'
import { API_BASE_URL } from '@/config'
import type { Post, Tag } from '@/types'
import type { Post } from '@/types'
type Props = { post: Post
onSave: (newPost: Post) => void }
@@ -19,9 +19,10 @@ export default ({ post, onSave }: Props) => {
.join (' '))
const handleSubmit = async () => {
const { data } = await axios.put (`${ API_BASE_URL }/posts/${ post.id }`, { title, tags },
const res = await axios.put (`${ API_BASE_URL }/posts/${ post.id }`, { title, tags },
{ headers: { 'Content-Type': 'multipart/form-data',
'X-Transfer-Code': localStorage.getItem ('user_code') || '' } } )
const data = res.data as Post
onSave ({ ...post,
title: data.title,
tags: data.tags } as Post)