emotion diary : fix error

This commit is contained in:
haerong22
2022-04-23 03:13:49 +09:00
parent 833117d08e
commit 5958339a81
7 changed files with 28 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -1,15 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<html lang="ko">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<meta name="description" content="나만의 감정 일기장" />
<title>React App</title>
<title>감정 일기장</title>
</head>
<body>
<div id="root"></div>

View File

@@ -49,9 +49,11 @@ function App() {
const diaryList = JSON.parse(localData).sort(
(a, b) => parseInt(b.id) - parseInt(a.id)
);
dataId.current = parseInt(diaryList[0].id) + 1;
dispatch({ type: "INIT", data: diaryList });
if (diaryList.length >= 1) {
dataId.current = parseInt(diaryList[0].id) + 1;
dispatch({ type: "INIT", data: diaryList });
}
}
}, []);

View File

@@ -13,6 +13,11 @@ const Diary = () => {
const [data, setData] = useState();
useEffect(() => {
const titleElement = document.getElementsByTagName("title")[0];
titleElement.innerHTML = `감정 일기장 - ${id}번 일기`;
}, []);
useEffect(() => {
if (diaryList.length >= 1) {
const targetDiary = diaryList.find(

View File

@@ -11,6 +11,11 @@ const Edit = () => {
const { id } = useParams();
useEffect(() => {
const titleElement = document.getElementsByTagName("title")[0];
titleElement.innerHTML = `감정 일기장 - ${id}번 일기 수정`;
}, []);
useEffect(() => {
if (diaryList.length >= 1) {
const targetDiary = diaryList.find(

View File

@@ -12,6 +12,11 @@ const Home = () => {
const headText = `${curDate.getFullYear()}${curDate.getMonth() + 1}`;
useEffect(() => {
const titleElement = document.getElementsByTagName("title")[0];
titleElement.innerHTML = `감정 일기장`;
}, []);
useEffect(() => {
if (diaryList.length >= 1) {
const firstDay = new Date(

View File

@@ -1,6 +1,11 @@
import { useEffect } from "react";
import DiaryEditor from "../components/DiaryEditor";
const New = () => {
useEffect(() => {
const titleElement = document.getElementsByTagName("title")[0];
titleElement.innerHTML = `감정 일기장 - 새 일기`;
}, []);
return (
<div>
<DiaryEditor />