Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions src/pages/SelectInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ const SelectInfo = () => {
? testResultMBTI
: undefined;

const confirmButtonText =
type === "fastFriend" ? "대화 시작하기" : "친구 저장하기";

const [selectedMBTI, setSelectedMBTI] = useState<{
[key: string]: string | null;
}>({
Expand Down Expand Up @@ -152,7 +155,7 @@ const SelectInfo = () => {
setTimeout(() => setToastMessage(null), 3000);
};

const handleStartChat = async () => {
const handleConfirmButton = async () => {
const isMBTIComplete = Object.values(selectedMBTI).every(
(val) => val !== null
);
Expand Down Expand Up @@ -201,16 +204,9 @@ const SelectInfo = () => {
if (type === "virtualFriend" && isVirtualFriendResponse(responseData)) {
trackEvent("Click", {
page: "친구 저장",
element: "대화 시작하기"
});
navigate("/chat", {
state: {
mbti,
mode: type,
id: responseData.conversationId,
name: responseData.virtualFriendName
}
element: "친구 저장하기"
});
navigate("/");
} else if (type === "fastFriend" && typeof responseData === "number") {
trackEvent("Click", {
page: "빠른 대화 설정",
Expand Down Expand Up @@ -372,9 +368,9 @@ const SelectInfo = () => {
{/* 대화 시작 버튼 */}
<button
className="my-[22px] h-[60px] w-full rounded-[8px] bg-primary-normal font-bold text-white"
onClick={handleStartChat}
onClick={handleConfirmButton}
>
대화 시작하기
{confirmButtonText}
</button>
</div>
</div>
Expand Down