Skip to content

Commit

Permalink
Refactor: add store code annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
swgvenghy committed Aug 6, 2024
1 parent 466bdc6 commit acc1d90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/store/admin/check-question-answer-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export interface QuestionAnswerState {

interface CheckQuestionAnswerState {
questionData: QuestionAnswerState[];
updateQuestionData: (firstData: QuestionAnswerState[]) => void;
inputQuestionData: (data: QuestionAnswerState) => void;
updateCheck: (id: number, isChecked: boolean) => void;
updateAnswer: (answerId: number, answerContent: string) => void;
updateQuestionData: (firstData: QuestionAnswerState[]) => void; //처음 데이터를 삽입할 때 사용하는 거
inputQuestionData: (data: QuestionAnswerState) => void; //커스텀 질문 생성시 사용하는거
updateCheck: (id: number, isChecked: boolean) => void; //질문-답변 상태 확인할 때 사용
updateAnswer: (answerId: number, answerContent: string) => void; //답변 내용 변경할 때 사용
}

const useCheckQuestionAnswerStore = create<CheckQuestionAnswerState>((set) => ({
Expand Down
8 changes: 4 additions & 4 deletions src/store/chat-store.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { create } from 'zustand';

interface ChatState {
messages: { content: string; role: 'user' | 'system' }[];
loading: boolean;
addMessage: (message: { content: string; role: 'user' | 'system' }) => void;
messages: { content: string; role: 'user' | 'system' }[]; //사용자와 시스템 메시지가 저장되는 배열
loading: boolean; //답변이 오는 기간동안 로딩상태 파악 위한 것으로, 스피너에 적용
addMessage: (message: { content: string; role: 'user' | 'system' }) => void; //새로운 메시지가 들어올때 사용
setLoading: (loading: boolean) => void;
updateLastMessage: (content: string) => void;
updateLastMessage: (content: string) => void; //유저가 새로운 질문을 할 때 화면에 보여지기 위해 사용되는 함수
}

const useChatStore = create<ChatState>((set) => ({
Expand Down

0 comments on commit acc1d90

Please sign in to comment.