Skip to content

Commit

Permalink
feature-081: 비회원일 때 영상 변환 후 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
gs0428 committed Feb 19, 2024
1 parent e409d9f commit abdf7a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
31 changes: 14 additions & 17 deletions src/components/layout/header/alarm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ 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;
};

const Alarm = ({ isDark }: Props) => {
const status = useRecoilValue(modelingStatusState);
const userToken = useRecoilValue(userTokenState);
const [isOpen, setIsOpen] = useState(false);
const [alarmList, setAlarmList] = useState<IAlarm[]>([]);

Expand All @@ -43,24 +41,23 @@ const Alarm = ({ isDark }: Props) => {

useEffect(() => {
if (status === 'ERROR' || status === 'COMPLETE') {
userToken && callAPI();
callAPI();
}

if (status === 'CONTINUE') {
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,
]);
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]);
Expand Down
6 changes: 2 additions & 4 deletions src/hooks/useCreateVideo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import {
modelingStatusState,
videoLinkState,
} from '@/stores/model-controller';
import { userTokenState } from '@/stores/user';
import { useNavigate } from 'react-router-dom';
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import { useRecoilState, useSetRecoilState } from 'recoil';

const useCreateVideo = () => {
const [modelingData, setModelingData] = useRecoilState(modelingDataState);
const userToken = useRecoilValue(userTokenState);
const setIsOpenErrorModal = useSetRecoilState(errorModalState);
const setVideoLink = useSetRecoilState(videoLinkState);
const setStatus = useSetRecoilState(modelingStatusState);
Expand All @@ -25,7 +23,7 @@ const useCreateVideo = () => {
try {
const { video_id } = (await createVideoAPI(modelingData)).data.result;

navigate(`/summary/${video_id}${!userToken && '?insight=true'}`);
navigate(`/summary/${video_id}`);
setModelingData(null);
} catch (e) {
setIsOpenErrorModal(true);
Expand Down

0 comments on commit abdf7a3

Please sign in to comment.