Skip to content

Commit

Permalink
발표 생성 페이지 중복 post 오류 수정, CDN baseUrl 환경변수 적용 (#36)
Browse files Browse the repository at this point in the history
* refactor: JSDoc 일부 수정

* fix: 중복 post 버그 수정

* fix: 페이지 이동 조건 수정

* refactor: CDN baseUrl 환경변수 적용
  • Loading branch information
minh0518 authored Feb 29, 2024
1 parent 43fb58b commit c0bc606
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const SelectSentenceSection = ({
<div className={styles.pptImageSection}>
<div className={styles.image}>
<Image
src={`http://124.49.161.33/${totalInfo.slides[currentPage].imageFilePath}`}
src={`${process.env.NEXT_PUBLIC_BASE_URL_CDN}/${totalInfo.slides[currentPage].imageFilePath}`}
width={500}
height={281}
alt={`${currentPage + 1}페이지 이미지`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ const SettingProcess = () => {
}
if (currentStep === 0 && settingInfo.practiceMode === 'SHOW') {
setCurrentStep(2);
}
if (currentStep !== 2) setCurrentStep((prev) => (prev + 1) as ProcessStepType);
} else if (currentStep !== 2) setCurrentStep((prev) => (prev + 1) as ProcessStepType);
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const ControlButtons = ({
})}
>
<Image
src={`http://124.49.161.33/${item.imageFilePath}`}
src={`${process.env.NEXT_PUBLIC_BASE_URL_CDN}/${item.imageFilePath}`}
fill
alt="ppt이미지"
style={{ objectFit: 'contain', borderRadius: '8px' }}
Expand Down
2 changes: 1 addition & 1 deletion src/app/(afterlogin)/upload/[id]/_component/UploadPpt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const UploadPpt = ({
<div className={styles.pptImageSection}>
<div className={styles.hoverSection}>
<Image
src={`http://124.49.161.33/${pptInfo.imageFilePath}`}
src={`${process.env.NEXT_PUBLIC_BASE_URL_CDN}/${pptInfo.imageFilePath}`}
alt={`${currentPageIndex + 1}페이지 ppt 이미지`}
width={503}
height={283}
Expand Down
5 changes: 4 additions & 1 deletion src/app/(afterlogin)/upload/[id]/_hooks/presentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export const usePostPresentationData = (submitAction: 'save' | 'start') => {
onSuccess: async (response) => {
const { presentationId } = await response.json();
if (submitAction === 'start') router.push(`/setting/${presentationId}`);
if (submitAction === 'save') openToastWithData();
if (submitAction === 'save') {
router.push(`/upload/${presentationId}`);
openToastWithData();
}
},
onError: () => {
alert('저장하는 도중 문제가 발생했습니다.');
Expand Down
13 changes: 8 additions & 5 deletions src/types/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ type ValuePiece = Date | null;

export type Value = ValuePiece | [ValuePiece, ValuePiece];

// mock
// # Mock

export interface ValidtaionType {
title: string;
script: string;
memo: string;
deadlineDate: Value;
}

// Mock
export interface MockUploadDataType {
id?: number;
dday?: number;
Expand All @@ -34,8 +33,12 @@ export interface MockUploadDataType {
}[];
}

// service
/** 유저 정보를 나타내는 객체 */
// # Service

/** 발표 자료 업로드 객체 - 발표 상세 조회, 생성 및 수정
* 기본타입 - 생성 및 수정에 사용되는 요소들
* 옵셔널타입 - 발표 상세 조회시, 추가되는 요소들
*/
export interface UploadDataType {
/** 발표 ID - URL에 라우팅 되는 값 */
id?: number;
Expand Down

0 comments on commit c0bc606

Please sign in to comment.