+
-
- {{ likeCount }}
+
+ {{ currentLikeCount }}
-
+
@@ -39,25 +39,75 @@ import CommentIcon from "~/assets/icon/commentIcon.svg";
import Like from "~/assets/icon/like.svg";
import FilledLike from "~/assets/icon/filledHeart.svg";
import dayjs from "dayjs";
-import { useMutation, useQueryClient } from "@tanstack/vue-query";
+import { useMutation } from "@tanstack/vue-query";
import { apiInstance } from "~/utils/api";
-const isLike = ref(false);
+const props = defineProps({
+ writer: {
+ type: String,
+ default: "작성자",
+ },
+ date: {
+ type: String,
+ default: "",
+ },
+ comment: {
+ type: String,
+ default: "",
+ },
+ commentCount: {
+ type: Number,
+ default: 1,
+ },
+ likeCount: {
+ type: Number,
+ default: 1,
+ },
+ userId: {
+ type: Number,
+ default: 1,
+ },
+ postId: {
+ type: Number,
+ required: true,
+ },
+ likeByUser: {
+ type: Boolean,
+ default: false,
+ },
+});
+
+// props.likeByUser로 초기값 설정
+const isLike = ref(props.likeByUser);
+const currentLikeCount = ref(props.likeCount);
+
+// props가 변경될 때 isLike 상태도 업데이트
+watch(
+ () => props.likeByUser,
+ (newValue) => {
+ isLike.value = newValue;
+ }
+);
+
+// likeCount props가 변경될 때 currentLikeCount도 업데이트
+watch(
+ () => props.likeCount,
+ (newValue) => {
+ currentLikeCount.value = newValue;
+ }
+);
const handleClickLike = () => {
- isLike.value = !isLike.value;
- if (isLike.value === true) {
+ if (isLike.value) {
+ handleDelete();
+ } else {
clickLike({
userId: props.userId,
postId: props.postId,
});
- } else {
- handleDelete();
}
};
-const queryClient = useQueryClient();
-
const { mutate: clickLike } = useMutation({
mutationFn: async (postData: { userId: number; postId: number }) => {
console.log("게시글 좋아요 누른 데이터:", postData);
@@ -69,9 +119,8 @@ const { mutate: clickLike } = useMutation({
},
onSuccess: (data) => {
console.log("좋아요 생성 성공:", data);
- queryClient.invalidateQueries({
- queryKey: ["post", props.postId],
- });
+ isLike.value = true;
+ currentLikeCount.value += 1;
},
onError: (error) => {
console.error("좋아요 생성 실패:", error);
@@ -91,9 +140,8 @@ const { mutate: cancelLike } = useMutation({
},
onSuccess: () => {
console.log("좋아요 삭제 성공");
- queryClient.invalidateQueries({
- queryKey: ["replies", props.postId],
- });
+ isLike.value = false;
+ currentLikeCount.value = Math.max(0, currentLikeCount.value - 1);
},
onError: (error) => {
console.error(`좋아요 삭제 실패했습니다: ${error.message}`);
@@ -103,35 +151,4 @@ const { mutate: cancelLike } = useMutation({
const handleDelete = () => {
cancelLike(props.postId);
};
-
-const props = defineProps({
- writer: {
- type: String,
- default: "작성자",
- },
- date: {
- type: String,
- default: "",
- },
- comment: {
- type: String,
- default: "",
- },
- commentCount: {
- type: Number,
- default: 1,
- },
- likeCount: {
- type: Number,
- default: 1,
- },
- userId: {
- type: Number,
- default: 1,
- },
- postId: {
- type: Number,
- required: true,
- },
-});
diff --git a/app/pages/community/_components/CommentWrap.vue b/app/pages/community/_components/CommentWrap.vue
index d0262dc..abf6983 100644
--- a/app/pages/community/_components/CommentWrap.vue
+++ b/app/pages/community/_components/CommentWrap.vue
@@ -1,37 +1,39 @@
-
+
-
-
-
+
+
{{ selectedAddress || "지역을 선택해주세요" }}
- 의 리뷰 게시글
+ 의
+
+ 리뷰 게시글
-
-
-
총 {{ " " }}
-
+
+
+ 총 {{ " " }}
+
{{ posts?.length || 0 }}
- 개
+ 개
-
+
{{ selectedOption }}
@@ -43,7 +45,7 @@
{{ option }}
@@ -68,10 +70,7 @@
-
+
-
-
댓글을 불러오는 중...
+
+
댓글을 불러오는 중...
-
+
댓글이 없습니다.
@@ -105,17 +105,22 @@
-
@@ -133,7 +138,6 @@ import PostReply from "./PostReply.vue";
import type { ReplyResponse } from "../_api/types/ReplyResponse";
import type { PostResponse } from "../_api/types/PostResponse";
-// Props 정의
const props = defineProps({
posts: {
type: Array,
diff --git a/app/pages/community/_components/PostReply.vue b/app/pages/community/_components/PostReply.vue
index de9176f..aed8e0c 100644
--- a/app/pages/community/_components/PostReply.vue
+++ b/app/pages/community/_components/PostReply.vue
@@ -1,6 +1,6 @@
@@ -24,7 +24,7 @@
diff --git a/app/pages/community/_components/ReplyItem.vue b/app/pages/community/_components/ReplyItem.vue
index 737f166..d5391d9 100644
--- a/app/pages/community/_components/ReplyItem.vue
+++ b/app/pages/community/_components/ReplyItem.vue
@@ -1,14 +1,12 @@
-
-
+
+
{{ writer }}
-
+
{{ dayjs(date).format("YYYY-MM-DD") }}
-
+
{{ comment }}
diff --git a/app/pages/community/_components/SearchBar.vue b/app/pages/community/_components/SearchBar.vue
index a2540ce..4517da9 100644
--- a/app/pages/community/_components/SearchBar.vue
+++ b/app/pages/community/_components/SearchBar.vue
@@ -38,7 +38,7 @@
@@ -29,7 +30,10 @@ const props = defineProps<{
{{ props.safetyDescription }}
-
+
자세히 보기
diff --git a/app/pages/my/_components/MyCredit.vue b/app/pages/my/_components/MyCredit.vue
index a0b0bda..564fd83 100644
--- a/app/pages/my/_components/MyCredit.vue
+++ b/app/pages/my/_components/MyCredit.vue
@@ -7,6 +7,7 @@
diff --git a/app/pages/my/index.vue b/app/pages/my/index.vue
index 93b6b2f..2c8ef98 100644
--- a/app/pages/my/index.vue
+++ b/app/pages/my/index.vue
@@ -5,6 +5,11 @@ import PostAchievementCard from "./_components/PostAchievementCard.vue";
import type { MyPageResponse } from "./_api/types/MyPageResponse";
import { useQuery } from "@tanstack/vue-query";
import { apiInstance } from "~/utils/api";
+import { useHead } from "#app";
+
+useHead({
+ title: "마이 페이지",
+});
const { data } = useQuery
>({
queryKey: ["mypage"],
@@ -22,6 +27,7 @@ console.log(data);
diff --git a/app/pages/pricing/_components/PriceBox.vue b/app/pages/pricing/_components/PriceBox.vue
index ffa7102..caeeb4d 100644
--- a/app/pages/pricing/_components/PriceBox.vue
+++ b/app/pages/pricing/_components/PriceBox.vue
@@ -2,7 +2,7 @@
{{ option }}
diff --git a/app/pages/pricing/index.vue b/app/pages/pricing/index.vue
index e546959..6ff564f 100644
--- a/app/pages/pricing/index.vue
+++ b/app/pages/pricing/index.vue
@@ -1,32 +1,49 @@
+
+
-
+
한 달간 무제한으로
-
+
매물의 안전지수를 확인해보세요.
PLUS 서비스 구독을 통해 더 다양한 셋방살이의 혜택을 이용하실 수 있습니다.
-
+
-
+
월
- 8,900
+ 8,900
원
-
+
-
+
0
- 원
+ 원
-
-
diff --git a/app/pages/quiz/Correct.vue b/app/pages/quiz/Correct.vue
index b141337..19a4792 100644
--- a/app/pages/quiz/Correct.vue
+++ b/app/pages/quiz/Correct.vue
@@ -1,10 +1,10 @@
-
+
- 정답입니다.
+ 정답입니다.
-
+
전입신고를 하면 확정일자가 자동으로 부여된다.
diff --git a/app/pages/quiz/False.vue b/app/pages/quiz/False.vue
index 4660f49..f455716 100644
--- a/app/pages/quiz/False.vue
+++ b/app/pages/quiz/False.vue
@@ -1,10 +1,10 @@
-
+
- 오답입니다.
+ 오답입니다.
-
+
정답: 전입신고를 하면 확정일자가 자동으로 부여된다.
diff --git a/app/pages/quiz/_components/Explain.vue b/app/pages/quiz/_components/Explain.vue
index 7532998..2d88f15 100644
--- a/app/pages/quiz/_components/Explain.vue
+++ b/app/pages/quiz/_components/Explain.vue
@@ -4,31 +4,31 @@
-
해설:
-
+
해설:
+
전입신고가 되었더라도
확정일자는 별도로
받아야 합니다.
-
+
1. 보증금 보호를 위해 전입신고는 필수다.
-
+
2. 전입신고는 동사무소나 온라인에서 할 수 있다.
-
+
4. 전입신고를 하면 주민등록 주소가 해당 집으로 변경된다.
-
+
-> 나머지 보기는 모두 맞는 사실입니다.
@@ -36,7 +36,7 @@
@@ -59,4 +59,11 @@ const handleCreditCheck = () => {
navigateTo("/my");
console.log("크레딧 페이지로 이동");
};
+
+const props = defineProps({
+ correct: {
+ type: Boolean,
+ required: false,
+ },
+});
diff --git a/app/pages/quiz/_modals/CompleteQuiz.vue b/app/pages/quiz/_modals/CompleteQuiz.vue
index 7a51b0c..688be9d 100644
--- a/app/pages/quiz/_modals/CompleteQuiz.vue
+++ b/app/pages/quiz/_modals/CompleteQuiz.vue
@@ -1,33 +1,31 @@
-
+
문제 풀이가 완료되었습니다
-
+
참여 감사합니다.
감사 크레딧
- 500P
-
+ 500P
+
가 적립되었습니다.