|
|
@@ -1,4 +1,5 @@ |
|
|
|
import axios from 'axios' |
|
|
|
import toCamel from 'camelcase-keys' |
|
|
|
import { useState } from 'react' |
|
|
|
|
|
|
|
import TextArea from '@/components/common/TextArea' |
|
|
@@ -22,7 +23,7 @@ export default ({ post, onSave }: Props) => { |
|
|
|
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 |
|
|
|
const data = toCamel (res.data as any, { deep: true }) as Post |
|
|
|
onSave ({ ...post, |
|
|
|
title: data.title, |
|
|
|
tags: data.tags } as Post) |
|
|
|