Skip to content
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

Merged
Merged
11 changes: 7 additions & 4 deletions app/addBoard/page.tsx
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";

Expand All @@ -12,6 +12,9 @@ export default function AddBoard() {

const titleErrMsg = document.querySelector(".titleEmpty");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기에 querySelector로 요소를 가져오신 이유가 있을까요.

const contentErrMsg = document.querySelector(".contentEmpty");
useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The 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>) => {
Expand All @@ -24,12 +27,12 @@ export default function AddBoard() {
}

//필수 값인 title과 content에 값이 있는지 확인
const title = formData.get("title");
const FormTitle = formData.get("title");
Copy link
Collaborator

Choose a reason for hiding this comment

The 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() === ""
) {
Expand Down
2 changes: 2 additions & 0 deletions app/board/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import Image from "next/image";
import BoardComment from "@/components/boardCommentList";

export default function DetailBoard({ params }: { params: { id: string } }) {
document.title = "판다마켓 | 자유게시판 상세 페이지";

const [boardData, setBoardData] = useState<IBoardDetail | null>(null);

useEffect(() => {
Expand Down
2 changes: 2 additions & 0 deletions app/board/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import BestBoard from "@/components/bestBoard";
import styles from "./board.module.css";
import BoardList from "@/components/boardList";

export const metadata = { title: "판다마켓 | 자유게시판" };

export default async function Board() {
const bestBoard = await getBoardList({
page: 1,
Expand Down