diff --git a/src/app/api/categories/route.ts b/src/app/api/categories/route.ts
index 9bcf0a0d..af2c4913 100644
--- a/src/app/api/categories/route.ts
+++ b/src/app/api/categories/route.ts
@@ -1,17 +1,9 @@
// 카테고리 목록 조회
export async function GET() {
- try {
- const response = await fetch(`${process.env.BACKEND_URL}/api/categories`, {
- method: "GET",
- next: { revalidate: 60, tags: ["getCategoryList"] },
- });
+ const response = await fetch(`${process.env.BACKEND_URL}/api/categories`, {
+ method: "GET",
+ next: { revalidate: 60, tags: ["getCategoryList"] },
+ });
- if (!response.ok) {
- throw new Error(response.statusText);
- }
-
- return response;
- } catch (err) {
- return new Response("Internal Server Error", { status: 500 });
- }
+ return response;
}
diff --git a/src/app/api/diary/[id]/route.ts b/src/app/api/diary/[id]/route.ts
index e16bccc4..e7e14095 100644
--- a/src/app/api/diary/[id]/route.ts
+++ b/src/app/api/diary/[id]/route.ts
@@ -25,10 +25,6 @@ export async function PUT(
},
);
- if (!response.ok) {
- throw new Error(response.statusText);
- }
-
revalidateTag("getDiaryList");
revalidateTag(`getDiary/${params.id}`);
return response;
diff --git a/src/app/api/informations/[id]/route.ts b/src/app/api/informations/[id]/route.ts
index 3cfd2264..df013129 100644
--- a/src/app/api/informations/[id]/route.ts
+++ b/src/app/api/informations/[id]/route.ts
@@ -1,5 +1,5 @@
import { UpdateInformationRequestDto } from "@/types/InformationDto";
-import { revalidatePath } from "next/cache";
+import { revalidatePath, revalidateTag } from "next/cache";
import { NextRequest } from "next/server";
/**
@@ -57,6 +57,7 @@ export async function PUT(
);
// Revalidate the cache
+ revalidateTag("getBestInformationList");
revalidatePath("/informations", "layout");
return response;
}
@@ -80,6 +81,7 @@ export async function DELETE(
},
);
+ revalidateTag("getBestInformationList");
revalidatePath("/informations", "layout");
return response;
}
diff --git a/src/app/api/informations/route.ts b/src/app/api/informations/route.ts
index 4f9a578b..9783c7b3 100644
--- a/src/app/api/informations/route.ts
+++ b/src/app/api/informations/route.ts
@@ -1,5 +1,5 @@
import { CreateInformationRequestDto } from "@/types/InformationDto";
-import { revalidatePath } from "next/cache";
+import { revalidatePath, revalidateTag } from "next/cache";
import { NextRequest } from "next/server";
// 정보 글 작성
@@ -19,6 +19,7 @@ export async function POST(request: NextRequest) {
});
// Revalidate the cache
+ revalidateTag("getBestInformationList");
revalidatePath("/informations", "layout");
return response;
}
diff --git a/src/components/diary/detail/DiaryViewer.tsx b/src/components/diary/detail/DiaryViewer.tsx
index 8ae6e635..b02d10c4 100644
--- a/src/components/diary/detail/DiaryViewer.tsx
+++ b/src/components/diary/detail/DiaryViewer.tsx
@@ -45,7 +45,7 @@ const DiaryViewer = ({ data, modalVisible, openModal, closeModal }: Props) => {
>
{data.diaryContentResponse.title}
-
+
{new Date(
new Date(data.diaryContentResponse.startDatetime).getTime() +
diff --git a/src/containers/diary/edit/DiaryEditorContainer.tsx b/src/containers/diary/edit/DiaryEditorContainer.tsx
index 1fc78509..29d5717a 100644
--- a/src/containers/diary/edit/DiaryEditorContainer.tsx
+++ b/src/containers/diary/edit/DiaryEditorContainer.tsx
@@ -4,7 +4,6 @@ import DiaryEditor from "@/components/diary/write/DiaryEditor";
import sanitizeOption from "@/constants/common/sanitizeOption";
import { FEELING_STATUS } from "@/constants/diary/feelingStatus";
import { DiaryUpdateFormSchema } from "@/lib/zod/schema/DiaryUpdateFormSchema";
-import useAuthStore from "@/store/authStore";
import { GetDiaryResponseDto, UpdateDiaryRequestDto } from "@/types/DiaryDto";
import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
@@ -13,8 +12,8 @@ import { parse } from "node-html-parser";
import { FormProvider, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import usePreventBodyScroll from "@/hooks/usePreventBodyScroll";
-import { fetchWithAuth } from "@/utils/fetchWithAuth";
import useModalBackHandler from "@/hooks/useModalBackHandler";
+import { fetchWithAuth } from "@/utils/fetchWithAuth";
interface Props {
diaryData: GetDiaryResponseDto;
@@ -22,7 +21,6 @@ interface Props {
const DiaryEditorContainer = ({ diaryData }: Props) => {
const router = useRouter();
- const authStore = useAuthStore();
const [dateRangeModal, setDateRangeModal] = useState(false);
const [addressModal, setAddressModal] = useState(false);
const [loading, setLoading] = useState(false);
@@ -35,7 +33,6 @@ const DiaryEditorContainer = ({ diaryData }: Props) => {
useModalBackHandler(addressModal, () => setAddressModal(false));
const methods = useForm<{
- userId: number;
title: string;
startDate: Date | null;
endDate: Date | null;
@@ -46,7 +43,6 @@ const DiaryEditorContainer = ({ diaryData }: Props) => {
}>({
resolver: zodResolver(DiaryUpdateFormSchema),
defaultValues: {
- userId: authStore.id,
title: "",
startDate: null,
endDate: null,
diff --git a/src/containers/diary/write/DiaryEditorContainer.tsx b/src/containers/diary/write/DiaryEditorContainer.tsx
index 768c33b2..1e9bff46 100644
--- a/src/containers/diary/write/DiaryEditorContainer.tsx
+++ b/src/containers/diary/write/DiaryEditorContainer.tsx
@@ -4,7 +4,6 @@ import DiaryEditor from "@/components/diary/write/DiaryEditor";
import sanitizeOption from "@/constants/common/sanitizeOption";
import { FEELING_STATUS } from "@/constants/diary/feelingStatus";
import { DiaryCreateFormSchema } from "@/lib/zod/schema/DiaryCreateFormSchema";
-import useAuthStore from "@/store/authStore";
import { CreateDiaryRequestDto } from "@/types/DiaryDto";
import { useRouter } from "next/navigation";
import { useState } from "react";
@@ -18,7 +17,6 @@ import useModalBackHandler from "@/hooks/useModalBackHandler";
const DiaryEditorContainer = () => {
const router = useRouter();
- const authStore = useAuthStore();
const [datePickerModal, setDatePickerModal] = useState(false);
const [addressModal, setAddressModal] = useState(false);
const [loading, setLoading] = useState(false);
@@ -29,7 +27,6 @@ const DiaryEditorContainer = () => {
useModalBackHandler(addressModal, () => setAddressModal(false));
const methods = useForm<{
- userId: number;
title: string;
startDate: Date | null;
endDate: Date | null;
@@ -40,7 +37,6 @@ const DiaryEditorContainer = () => {
}>({
resolver: zodResolver(DiaryCreateFormSchema),
defaultValues: {
- userId: authStore.id,
title: "",
startDate: null,
endDate: null,
diff --git a/src/containers/diary/write/QuillEditorContainer.tsx b/src/containers/diary/write/QuillEditorContainer.tsx
index 4feb5a09..45a1e04a 100644
--- a/src/containers/diary/write/QuillEditorContainer.tsx
+++ b/src/containers/diary/write/QuillEditorContainer.tsx
@@ -113,11 +113,8 @@ const QuillEditorContainer = () => {
// https://quilljs.com/docs/modules/toolbar
toolbar: {
container: [
- [{ size: ["small", false, "large", "huge"] }, { font: [] }],
[{ color: [] }, { background: [] }],
- [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
["bold", "italic", "underline", "strike"],
- [{ indent: "-1" }, { indent: "+1" }, { align: [] }],
["link", "image", "video"],
],
handlers: { image: imageHandler },
diff --git a/src/lib/zod/schema/DiaryCreateFormSchema.ts b/src/lib/zod/schema/DiaryCreateFormSchema.ts
index dfd9d9ae..0d4b047b 100644
--- a/src/lib/zod/schema/DiaryCreateFormSchema.ts
+++ b/src/lib/zod/schema/DiaryCreateFormSchema.ts
@@ -1,13 +1,6 @@
import { z } from "zod";
export const DiaryCreateFormSchema = z.object({
- userId: z
- .number({
- required_error: "로그인을 해야 일기 작성이 가능합니다.",
- invalid_type_error: "UserId must be a integer.",
- })
- .int()
- .positive(),
title: z
.string({
required_error: "제목을 입력해 주세요.",
diff --git a/src/lib/zod/schema/DiaryUpdateFormSchema.ts b/src/lib/zod/schema/DiaryUpdateFormSchema.ts
index f7d30e94..68f67bfb 100644
--- a/src/lib/zod/schema/DiaryUpdateFormSchema.ts
+++ b/src/lib/zod/schema/DiaryUpdateFormSchema.ts
@@ -1,13 +1,6 @@
import { z } from "zod";
export const DiaryUpdateFormSchema = z.object({
- userId: z
- .number({
- required_error: "로그인을 해야 일기 작성이 가능합니다.",
- invalid_type_error: "UserId must be a integer.",
- })
- .int()
- .positive(),
title: z
.string({
required_error: "제목을 입력해 주세요.",