-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[김혜선] sprint11 #684
The head ref may contain hidden characters: "Next.js-\uAE40\uD61C\uC120"
[김혜선] sprint11 #684
Changes from 1 commit
807616f
34f1037
4d5982f
e5b5b78
8552110
8e34718
1f0c7c2
ff45de3
4ffed1d
f291ec0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
"use client"; | ||
import styles from "./addBoard.module.css"; | ||
import { addBoard, uploadImage } from "../api/board"; | ||
import { useRef, useState } from "react"; | ||
import { useEffect, useRef, useState } from "react"; | ||
import FileInput from "@/components/fileInput"; | ||
import { useRouter } from "next/navigation"; | ||
|
||
|
@@ -12,6 +12,9 @@ export default function AddBoard() { | |
|
||
const titleErrMsg = document.querySelector(".titleEmpty"); | ||
const contentErrMsg = document.querySelector(".contentEmpty"); | ||
useEffect(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. document.title를 useEffect에 사용하지 마시고 app router이니 export const metadata로 하면 overwrite 될거에요. |
||
document.title = "판다마켓 | 자유게시판 게시글 등록"; | ||
}, []); | ||
|
||
//이제 formdata 안써야지. | ||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => { | ||
|
@@ -24,12 +27,12 @@ export default function AddBoard() { | |
} | ||
|
||
//필수 값인 title과 content에 값이 있는지 확인 | ||
const title = formData.get("title"); | ||
const FormTitle = formData.get("title"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 파스칼 케이스로 하신 이유가 있을까요. |
||
const content = formData.get("content"); | ||
|
||
if ( | ||
!title || | ||
title.toString().trim() === "" || | ||
!FormTitle || | ||
FormTitle.toString().trim() === "" || | ||
!content || | ||
content.toString().trim() === "" | ||
) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기에 querySelector로 요소를 가져오신 이유가 있을까요.