catch
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useLocation } from 'react-router';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { HeaderType } from '@/entities/common/model/types';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
useSetHeaderTitle,
|
||||
useSetHeaderType,
|
||||
useSetFooterMode,
|
||||
useSetOnBack
|
||||
} from '@/widgets/sub-layout/use-sub-layout';
|
||||
|
||||
export const FaqDetailPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const location = useLocation();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [cursorId, setCursorId] = useState<number>(0);
|
||||
const [seq, setSeq] = useState<string>('');
|
||||
const [category, setCategory] = useState<string>('');
|
||||
const [title, setTitle] = useState<string>('');
|
||||
const [contents, setContents] = useState<string>('');
|
||||
|
||||
useSetHeaderTitle(t('support.faq.title'));
|
||||
useSetHeaderType(HeaderType.LeftArrow);
|
||||
useSetFooterMode(false);
|
||||
useSetOnBack(() => {
|
||||
navigate(PATHS.support.faq.list);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setCursorId(location?.state.cursorId);
|
||||
setSeq(location?.state.seq);
|
||||
setCategory(location?.state.category);
|
||||
setTitle(location?.state.title);
|
||||
setContents(location?.state.contents);
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
<main>
|
||||
{ contents &&
|
||||
<div className="tab-content">
|
||||
<div className="tab-pane sub active">
|
||||
<div className="faq-detail">
|
||||
<div className="faq-detail__title">{ title }</div>
|
||||
<div className="faq-detail__divider"></div>
|
||||
<div className="faq-detail__body" dangerouslySetInnerHTML={{ __html: contents || '' }}></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
} from '@/widgets/sub-layout/use-sub-layout';
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
import { FaqDetail } from '@/entities/support/ui/detail/faq-detail';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
export const FaqListPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
@@ -95,6 +96,11 @@ export const FaqListPage = () => {
|
||||
&& rs.nextCursor !== pageParam.cursor
|
||||
&& rs.content.length === DEFAULT_PAGE_PARAM.size
|
||||
);
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useLocation } from 'react-router';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useNoticeDetailMutation } from '@/entities/support/api/use-notice-detail-mutation';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { HeaderType } from '@/entities/common/model/types';
|
||||
import { NoticeDetailParams, NoticeDetailResponse, NoticeItem } from '@/entities/support/model/types';
|
||||
import {
|
||||
useSetHeaderTitle,
|
||||
useSetHeaderType,
|
||||
useSetFooterMode,
|
||||
useSetOnBack
|
||||
} from '@/widgets/sub-layout/use-sub-layout';
|
||||
import moment from 'moment';
|
||||
|
||||
export const NoticeDetailPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const location = useLocation();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [result, setResult] = useState<NoticeItem>({});
|
||||
|
||||
let from = location?.state.from;
|
||||
|
||||
useSetHeaderTitle(t('support.notice.title'));
|
||||
useSetHeaderType(HeaderType.RightClose);
|
||||
useSetFooterMode(false);
|
||||
useSetOnBack(() => {
|
||||
if(from){
|
||||
navigate(from);
|
||||
}
|
||||
else{
|
||||
navigate(PATHS.support.notice.list);
|
||||
}
|
||||
});
|
||||
|
||||
const { mutateAsync: noticeDetail } = useNoticeDetailMutation();
|
||||
|
||||
const callDetail = () => {
|
||||
let detailParams: NoticeDetailParams = {
|
||||
seq: location?.state.seq,
|
||||
};
|
||||
noticeDetail(detailParams).then((rs: NoticeDetailResponse) => {
|
||||
setResult(rs);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
callDetail();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<main>
|
||||
{ result.informCl &&
|
||||
<div className="tab-content">
|
||||
<div className="tab-pane sub active">
|
||||
<div className="option-list">
|
||||
<div className="notice-detail">
|
||||
<div className="notice-detail__title">{ result.title }</div>
|
||||
<div className="notice-detail__meta">{ moment(result.regDt).format('YYYY.MM.DD') } | { t(`support.notice.categories.${result.informCl}`) }</div>
|
||||
<div className="notice-detail__divider"></div>
|
||||
<div className="notice-detail__body" dangerouslySetInnerHTML={{ __html: result.contents || '' }}></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
import { NoticeDetail } from '@/entities/support/ui/detail/notice-detail';
|
||||
import { useParams } from 'react-router';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
export const NoticeListPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
@@ -97,8 +98,13 @@ export const NoticeListPage = () => {
|
||||
&& rs.nextCursor !== pageParam.cursor
|
||||
&& rs.content.length === DEFAULT_PAGE_PARAM.size
|
||||
);
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
const onClickToAction = () => {
|
||||
// Remove focus from active element
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
import moment from 'moment';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useLocation } from 'react-router';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { HeaderType } from '@/entities/common/model/types';
|
||||
import {
|
||||
useSetHeaderTitle,
|
||||
useSetHeaderType,
|
||||
useSetFooterMode,
|
||||
useSetOnBack
|
||||
} from '@/widgets/sub-layout/use-sub-layout';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const QnaDetailPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
|
||||
const [answer, setAnswer] = useState<string>('');
|
||||
const [answerDate, setAnswerDate] = useState<string>('');
|
||||
const [contents, setContents] = useState<string>('');
|
||||
const [corpName, setCorpName] = useState<string | null>('');
|
||||
const [cursorId, setCursorId] = useState<number>(0);
|
||||
const [requestDate, setRequestDate] = useState<string>('');
|
||||
const [requestName, setRequestName] = useState<string>('');
|
||||
const [requestType, setRequestType] = useState<string>('');
|
||||
const [sendEmail, setSendEmail] = useState<string>('');
|
||||
const [seq, setSeq] = useState<string>('');
|
||||
const [statusCode, setStatusCode] = useState<string>('');
|
||||
const [title, setTitle] = useState<string>('');
|
||||
|
||||
useSetHeaderTitle(t('support.qna.title'));
|
||||
useSetHeaderType(HeaderType.LeftArrow);
|
||||
useSetFooterMode(false);
|
||||
useSetOnBack(() => {
|
||||
navigate(PATHS.support.qna.list);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setAnswer(location?.state.answer);
|
||||
setAnswerDate(location?.state.answerDate);
|
||||
setContents(location?.state.contents);
|
||||
setCorpName(location?.state.corpName);
|
||||
setCursorId(location?.state.cursorId);
|
||||
setRequestDate(location?.state.requestDate);
|
||||
setRequestName(location?.state.requestName);
|
||||
setRequestType(location?.state.requestType);
|
||||
setSendEmail(location?.state.sendEmail);
|
||||
setSeq(location?.state.seq);
|
||||
setStatusCode(location?.state.statusCode);
|
||||
setTitle(location?.state.title);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<main>
|
||||
{ statusCode &&
|
||||
<div className="tab-content">
|
||||
<div className="tab-pane active">
|
||||
<div className="inq-detail">
|
||||
<div className="inq-detail__head">
|
||||
<div className="inq-detail__row">
|
||||
<span className="inq-badge">{t('support.qna.detailLabels.title')}</span>
|
||||
<span className="inq-head-text bold">{ title }</span>
|
||||
</div>
|
||||
<div className="inq-detail__row">
|
||||
<span className="inq-badge">{t('support.qna.detailLabels.type')}</span>
|
||||
<span className="inq-head-text">{ t(`support.qna.categories.${requestType}`) }</span>
|
||||
</div>
|
||||
<div className="inq-detail__row">
|
||||
<span className="inq-badge">{t('support.qna.detailLabels.registrationDate')}</span>
|
||||
<span className="inq-head-text">{ !!requestDate? moment(requestDate).format('YYYY.MM.DD'): '' }</span>
|
||||
</div>
|
||||
<div className="inq-detail__row">
|
||||
<span className="inq-badge">{t('support.qna.detailLabels.answerDate')}</span>
|
||||
<span className="inq-head-text">{ !!answerDate? moment(answerDate).format('YYYY.MM.DD'): '' }</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="inq-detail__divider"></div>
|
||||
<div className="inq-detail__section">
|
||||
<div className="inq-detail__section-title">{t('support.qna.detailLabels.inquiryAnswer')}</div>
|
||||
<div className="inq-detail__body" dangerouslySetInnerHTML={{ __html: answer || '' }}></div>
|
||||
</div>
|
||||
<div className="inq-detail__section">
|
||||
<div className="inq-detail__section-title">{t('support.qna.detailLabels.inquiryContents')}</div>
|
||||
<div className="inq-detail__body" dangerouslySetInnerHTML={{ __html: contents || '' }}></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -109,6 +109,11 @@ export const QnaListPage = () => {
|
||||
&& rs.nextCursor !== pageParam.cursor
|
||||
&& rs.content.length === DEFAULT_PAGE_PARAM.size
|
||||
);
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -139,6 +139,11 @@ export const QnaRegisterPage = () => {
|
||||
qnaSave(params).then((rs: QnaSaveResponse) => {
|
||||
alert(t('support.qna.successMessage'));
|
||||
navigate(PATHS.support.qna.list);
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user