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

전역상태 저장값 Reset 기능구현을 완료한다 #164

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
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
24 changes: 12 additions & 12 deletions src/pages/emotion/message/EmotionMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,20 @@ const EmotionMessage = () => {
**응답 형식**:
{
"prediction": {
"totalScore": "숫자",
"social": "숫자",
"sexual": "숫자",
"relational": "숫자",
"refusing": "숫자",
"essential": "숫자"
"totalScore": 숫자,
"social": 숫자,
"sexual": 숫자,
"relational": 숫자,
"refusing": 숫자,
"essential": 숫자
},
"emotions": {
"joy": "숫자",
"sadness": "숫자",
"anger": "숫자",
"fear": "숫자",
"surprise": "숫자",
"disgust": "숫자"
"joy": 숫자,
"sadness": 숫자,
"anger": 숫자,
"fear": 숫자,
"surprise": 숫자,
"disgust": 숫자
},
"missions": ["내용", "내용"],
"keywords": "#내용 #내용 #내용"
Expand Down
14 changes: 13 additions & 1 deletion src/pages/emotion/result/EmotionResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ import ECharts from 'echarts-for-react';
// import { useEffect, useState } from 'react';
import Button from '@components/common/Button';
import { useNavigate } from 'react-router-dom';
import usePrevRecordStore from '@store/usePrevRecordStore';
import useEmotionStore from '@store/useEmotionStore';

const EmotionResult = () => {
const analysisResult = useAnalysisStore((state) => state.analysis) || { keywords: [] };
const analysisResult = useAnalysisStore((state) => state.analysis);
const prevRecord = usePrevRecordStore((state) => state.record);
const resetEmotion = useEmotionStore((state) => state.reset);
const resetAnalysisResult = useAnalysisStore((state) => state.reset);
const resetPrevRecord = useAnalysisStore((state) => state.reset);
const navigate = useNavigate();

console.log(prevRecord);
console.log(analysisResult);
// const [data, setData] = useState(null);
// const result_pk = 1;

Expand All @@ -31,6 +40,9 @@ const EmotionResult = () => {
// if (!data) return <div>로딩중.. 데이터가 없음</div>;

const handleClick = () => {
resetEmotion();
resetAnalysisResult();
resetPrevRecord();
navigate('/');
};

Expand Down