diff --git a/frontend/src/hooks/common/socket/useLandingSocket.ts b/frontend/src/hooks/common/socket/useLandingSocket.ts index fcbeb33..1f4b2d5 100644 --- a/frontend/src/hooks/common/socket/useLandingSocket.ts +++ b/frontend/src/hooks/common/socket/useLandingSocket.ts @@ -1,68 +1,27 @@ import { Socket } from "socket.io-client"; import { useEffect, useState } from "react"; -import { - LandingDTO, - LandingLinkDTO, - LandingMemoDTO, - LandingProjectDTO, - LandingSprintDTO, -} from "../../../types/DTO/landingDTO"; +import { LandingDTO, LandingProjectDTO } from "../../../types/DTO/landingDTO"; import { DEFAULT_VALUE } from "../../../constants/landing"; import { LandingSocketData, LandingSocketDomain, - LandingSocketMemoAction, } from "../../../types/common/landing"; const useLandingSocket = (socket: Socket) => { const [project, setProject] = useState( DEFAULT_VALUE.PROJECT ); - const [sprint, setSprint] = useState(null); - const [memoList, setMemoList] = useState([]); - const [link, setLink] = useState([]); const handleInitEvent = (content: LandingDTO) => { - const { project, sprint, memoList, link } = content as LandingDTO; + const { project } = content as LandingDTO; setProject(project); - setSprint(sprint); - setMemoList(memoList); - setLink(link); }; - const handleMemoEvent = ( - action: LandingSocketMemoAction, - content: LandingMemoDTO - ) => { - switch (action) { - case LandingSocketMemoAction.CREATE: - setMemoList((memoList: LandingMemoDTO[]) => [content, ...memoList]); - break; - case LandingSocketMemoAction.DELETE: - setMemoList((memoList: LandingMemoDTO[]) => - memoList.filter((memo: LandingMemoDTO) => memo.id !== content.id) - ); - break; - case LandingSocketMemoAction.COLOR_UPDATE: - setMemoList((memoList: LandingMemoDTO[]) => - memoList.map((memo: LandingMemoDTO) => { - if (memo.id !== content.id) { - return memo; - } - return { ...memo, color: content.color }; - }) - ); - } - }; - - const handleOnLanding = ({ domain, action, content }: LandingSocketData) => { + const handleOnLanding = ({ domain, content }: LandingSocketData) => { switch (domain) { case LandingSocketDomain.INIT: handleInitEvent(content); break; - case LandingSocketDomain.MEMO: - handleMemoEvent(action, content); - break; } }; @@ -77,9 +36,6 @@ const useLandingSocket = (socket: Socket) => { return { project, - sprint, - memoList, - link, }; };