fix: change inquiry save parameter type to form data
This commit is contained in:
parent
e05f142df2
commit
1d77fec86d
@ -3,17 +3,19 @@ import { NextResponse } from 'next/server'
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const formData = await request.formData()
|
||||
console.log('formData:: ', formData)
|
||||
|
||||
try {
|
||||
const response = await axios.post(`${process.env.NEXT_PUBLIC_INQUIRY_API_URL}/api/qna/save`, formData)
|
||||
|
||||
const response = await axios.post(`${process.env.NEXT_PUBLIC_INQUIRY_API_URL}/api/qna/save`, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
})
|
||||
console.log('response:: ', response)
|
||||
if (response.status === 200) {
|
||||
return NextResponse.json(response.data)
|
||||
}
|
||||
return NextResponse.json({ error: response.data }, { status: response.status })
|
||||
} catch (error) {
|
||||
console.error('error:: ', error)
|
||||
} catch (error: any) {
|
||||
console.error('error:: ', error.response)
|
||||
return NextResponse.json({ error: 'Failed to save qna' }, { status: 500 })
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,11 +69,6 @@ export default function Detail() {
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
<li className="file-item">
|
||||
<button className="file-item-bx" onClick={() => downloadFile(Number(1))}>
|
||||
<div className="file-item-name">Test File</div>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -48,7 +48,7 @@ export default function ListTable() {
|
||||
} else {
|
||||
setHeldInquiryList([])
|
||||
}
|
||||
}, [inquiryList, offset])
|
||||
}, [inquiryList, offset, setHeldInquiryList])
|
||||
|
||||
const handleMyInquiry = () => {
|
||||
setInquiryListRequest({ ...inquiryListRequest, schRegId: inquiryListRequest.schRegId ? null : session.userId })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user