qna
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
|
||||
export const codesCacheRefresh = () => {
|
||||
return resultify(
|
||||
axios.post<CodesCacheRefreshResponse>(API_URL.counselList()),
|
||||
axios.post<CodesCacheRefreshResponse>(API_URL.codesCacheRefresh()),
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
export const DEFAULT_PAGE_PARAM = {
|
||||
cursor: 'string',
|
||||
page: 0,
|
||||
size: 0,
|
||||
sortBy: 'string',
|
||||
sortOrder: 'ASC',
|
||||
orderBy: 'string',
|
||||
limit: 0,
|
||||
offset: 0
|
||||
};
|
||||
@@ -1,3 +1,11 @@
|
||||
export interface DefaultRequestPagination {
|
||||
page: number;
|
||||
size: number;
|
||||
sortBy: string;
|
||||
sortOrder: string;
|
||||
orderBy: string;
|
||||
offset: number;
|
||||
};
|
||||
export interface DefaulResponsePagination {
|
||||
nextCursor: string | null;
|
||||
hasNext: boolean;
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
CounselListParams,
|
||||
CounselListResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const counselList = (params: CounselListParams) => {
|
||||
return resultify(
|
||||
axios.post<CounselListResponse>(API_URL.counselList(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCounselListMutation = (options?: UseMutationOptions<CounselListResponse, CBDCAxiosError, CounselListParams>) => {
|
||||
const mutation = useMutation<CounselListResponse, CBDCAxiosError, CounselListParams>({
|
||||
...options,
|
||||
mutationFn: (params: CounselListParams) => counselList(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -1,29 +0,0 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
CounselSaveParams,
|
||||
CounselSaveResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const counselSave = (params: CounselSaveParams) => {
|
||||
return resultify(
|
||||
axios.post<CounselSaveResponse>(API_URL.counselSave(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCounselSaveMutation = (options?: UseMutationOptions<CounselSaveResponse, CBDCAxiosError, CounselSaveParams>) => {
|
||||
const mutation = useMutation<CounselSaveResponse, CBDCAxiosError, CounselSaveParams>({
|
||||
...options,
|
||||
mutationFn: (params: CounselSaveParams) => counselSave(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
29
src/entities/support/api/use-qna-list-mutation.ts
Normal file
29
src/entities/support/api/use-qna-list-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
QnaListParams,
|
||||
QnaListResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const qnaList = (params: QnaListParams) => {
|
||||
return resultify(
|
||||
axios.post<QnaListResponse>(API_URL.qnaList(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useQnaListMutation = (options?: UseMutationOptions<QnaListResponse, CBDCAxiosError, QnaListParams>) => {
|
||||
const mutation = useMutation<QnaListResponse, CBDCAxiosError, QnaListParams>({
|
||||
...options,
|
||||
mutationFn: (params: QnaListParams) => qnaList(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
29
src/entities/support/api/use-qna-save-mutation.ts
Normal file
29
src/entities/support/api/use-qna-save-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
QnaSaveParams,
|
||||
QnaSaveResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const qnaSave = (params: QnaSaveParams) => {
|
||||
return resultify(
|
||||
axios.post<QnaSaveResponse>(API_URL.qnaSave(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useQnaSaveMutation = (options?: UseMutationOptions<QnaSaveResponse, CBDCAxiosError, QnaSaveParams>) => {
|
||||
const mutation = useMutation<QnaSaveResponse, CBDCAxiosError, QnaSaveParams>({
|
||||
...options,
|
||||
mutationFn: (params: QnaSaveParams) => qnaSave(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DefaulResponsePagination } from '@/entities/common/model/types';
|
||||
import { DefaulResponsePagination, DefaultRequestPagination } from '@/entities/common/model/types';
|
||||
|
||||
export interface SupportParams {
|
||||
mid?: string;
|
||||
@@ -6,8 +6,9 @@ export interface SupportParams {
|
||||
export interface FaqListParams {
|
||||
category: string;
|
||||
searchValue: string;
|
||||
page?: DefaultRequestPagination;
|
||||
};
|
||||
export interface FaqListItem {
|
||||
export interface FaqItem {
|
||||
sortNo?: string;
|
||||
seq?: string;
|
||||
category?: string;
|
||||
@@ -16,31 +17,34 @@ export interface FaqListItem {
|
||||
contents?: string;
|
||||
};
|
||||
export interface FaqListResponse extends DefaulResponsePagination {
|
||||
content: Array<FaqListItem>;
|
||||
content: Array<FaqItem>;
|
||||
hasNext: boolean;
|
||||
nextCursor: string | null;
|
||||
};
|
||||
export interface FaqItemProps extends FaqListItem {
|
||||
export interface FaqItemProps extends FaqItem {
|
||||
|
||||
}
|
||||
export interface CounselListParams extends SupportParams {
|
||||
|
||||
export interface QnaListParams extends SupportParams {
|
||||
page?: DefaultRequestPagination;
|
||||
};
|
||||
export interface CounselListItemProps {
|
||||
sortNo: string;
|
||||
seq: string;
|
||||
statusCode: string;
|
||||
statusName: string;
|
||||
requestDate: string;
|
||||
requestName: string;
|
||||
title: string;
|
||||
contents: string;
|
||||
answer: string;
|
||||
export interface QnaItem {
|
||||
sortNo?: string;
|
||||
seq?: string;
|
||||
statusCode?: string;
|
||||
statusName?: string;
|
||||
requestDate?: string;
|
||||
requestName?: string;
|
||||
title?: string;
|
||||
contents?: string;
|
||||
answer?: string;
|
||||
};
|
||||
export interface CounselListResponse extends DefaulResponsePagination {
|
||||
content: Array<CounselListItemProps>
|
||||
export interface QnaListResponse extends DefaulResponsePagination {
|
||||
content: Array<QnaItem>
|
||||
};
|
||||
export interface CounselSaveParams extends SupportParams {
|
||||
export interface QnaItemProps extends QnaItem {
|
||||
|
||||
};
|
||||
export interface QnaSaveParams extends SupportParams {
|
||||
counselType: string;
|
||||
requestName: string;
|
||||
requestTel: string;
|
||||
@@ -48,6 +52,6 @@ export interface CounselSaveParams extends SupportParams {
|
||||
title: string;
|
||||
contents: string;
|
||||
};
|
||||
export interface CounselSaveResponse {
|
||||
export interface QnaSaveResponse {
|
||||
|
||||
};
|
||||
50
src/entities/support/ui/qna-item.tsx
Normal file
50
src/entities/support/ui/qna-item.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
import moment from 'moment';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { QnaItemProps } from '../model/types';
|
||||
|
||||
export const SupportQnaItem = ({
|
||||
sortNo,
|
||||
seq,
|
||||
statusCode,
|
||||
statusName,
|
||||
requestDate,
|
||||
requestName,
|
||||
title,
|
||||
contents,
|
||||
answer
|
||||
}: QnaItemProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
|
||||
const onClickToDetail = () => {
|
||||
navigate(PATHS.support.qna.detail, {
|
||||
state: {
|
||||
statusCode,
|
||||
statusName,
|
||||
requestDate,
|
||||
requestName,
|
||||
title,
|
||||
contents,
|
||||
answer
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className="inq-item"
|
||||
onClick={ () => onClickToDetail() }
|
||||
>
|
||||
<div className="inq-line">
|
||||
<div className="inq-title-text">{ contents }</div>
|
||||
<div className="inq-meta">
|
||||
등록일<span>{ moment(requestDate).format('YYYY.MM.DD') }</span>
|
||||
<span className="sai">ㅣ</span>상태 <span>[{ statusName }]</span>
|
||||
</div>
|
||||
<span className={`dot ${(statusCode === '03')? 'blue': 'gray'}`}></span>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user