fix: useNoticeWrite 훅 형식 변경

This commit is contained in:
정기영 2024-07-29 09:42:52 +09:00
parent 7321323b70
commit 65f66ee96e
2 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,14 @@ import instance from '../../utils/axios/instance';
import { API_URL } from '../../constants';
export function useNoticeWrite() {
const noticeWrite = (newNotice) => {
const noticeWrite = (lectureId, title, content) => {
const newNotice = {
lectureId: Number(lectureId),
title,
category: 'announcement',
content,
};
console.log(newNotice);
return instance.post(`${API_URL}/board`, newNotice);
};

View File

@ -10,15 +10,8 @@ export default function NoticeWritePage() {
const handleSubmit = async (e, title, content) => {
e.preventDefault();
console.log('handleSubmit');
console.log(title, content);
const response = await noticeWrite({
lectureId: Number(lectureId),
title,
category: 'announcement',
content,
});
const response = await noticeWrite(lectureId, title, content);
console.log('response : ', response);
navigate('..');
};