diff --git a/src/components/layout/header/alarm/index.tsx b/src/components/layout/header/alarm/index.tsx index 66ae127..27fba10 100644 --- a/src/components/layout/header/alarm/index.tsx +++ b/src/components/layout/header/alarm/index.tsx @@ -15,6 +15,7 @@ import { modelingStatusState } from '@/stores/model-controller'; import * as HeaderStyle from '@/styles/layout/header'; import AlarmList from './AlarmList'; +import { userTokenState } from '@/stores/user'; type Props = { isDark: boolean; @@ -22,6 +23,7 @@ type Props = { const Alarm = ({ isDark }: Props) => { const status = useRecoilValue(modelingStatusState); + const userToken = useRecoilValue(userTokenState); const [isOpen, setIsOpen] = useState(false); const [alarmList, setAlarmList] = useState([]); @@ -41,24 +43,24 @@ const Alarm = ({ isDark }: Props) => { useEffect(() => { if (status === 'ERROR' || status === 'COMPLETE') { - console.log(status, 'dd'); - callAPI(); + userToken && callAPI(); } if (status === 'CONTINUE') { - setAlarmList([ - { - state: 'success', - type: 'video', - alarm_id: 999, - title: '열심히 영상을 변환하는 중이에요!', - content: '잠시후 멋진 글을 만날 수 있어요:)', - is_confirm: 0, - created_at: new Date().toString(), - updated_at: new Date().toString(), - }, - ...alarmList, - ]); + userToken && + setAlarmList([ + { + state: 'success', + type: 'video', + alarm_id: 999, + title: '열심히 영상을 변환하는 중이에요!', + content: '잠시후 멋진 글을 만날 수 있어요:)', + is_confirm: 0, + created_at: new Date().toString(), + updated_at: new Date().toString(), + }, + ...alarmList, + ]); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [status]); diff --git a/src/hooks/useCreateVideo.ts b/src/hooks/useCreateVideo.ts index 789a596..bcfeeb2 100644 --- a/src/hooks/useCreateVideo.ts +++ b/src/hooks/useCreateVideo.ts @@ -22,18 +22,14 @@ const useCreateVideo = () => { const createVideo = async () => { if (!modelingData) return; - if (userToken) { - try { - const { video_id } = (await createVideoAPI(modelingData)).data.result; + try { + const { video_id } = (await createVideoAPI(modelingData)).data.result; - navigate(`/summary/${video_id}`); - setModelingData(null); - } catch (e) { - setIsOpenErrorModal(true); - console.error(e); - } - } else { - navigate('/summary/guest'); + navigate(`/summary/${video_id}${!userToken && '?insight=true'}`); + setModelingData(null); + } catch (e) { + setIsOpenErrorModal(true); + console.error(e); } setVideoLink(null);