fix: useNoticeWrite 훅 형식 변경
This commit is contained in:
parent
7321323b70
commit
65f66ee96e
@ -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);
|
||||
};
|
||||
|
||||
|
@ -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('..');
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user