첫 커밋
This commit is contained in:
29
src/entities/support/api/use-counsel-list-mutation.ts
Normal file
29
src/entities/support/api/use-counsel-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 {
|
||||
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,
|
||||
};
|
||||
};
|
||||
29
src/entities/support/api/use-counsel-save-mutation.ts
Normal file
29
src/entities/support/api/use-counsel-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 {
|
||||
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-faq-list-mutation.ts
Normal file
29
src/entities/support/api/use-faq-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 {
|
||||
FaqListParams,
|
||||
FaqListResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const faqList = (params: FaqListParams) => {
|
||||
return resultify(
|
||||
axios.post<FaqListResponse>(API_URL.faqList(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useFaqListMutation = (options?: UseMutationOptions<FaqListResponse, CBDCAxiosError, FaqListParams>) => {
|
||||
const mutation = useMutation<FaqListResponse, CBDCAxiosError, FaqListParams>({
|
||||
...options,
|
||||
mutationFn: (params: FaqListParams) => faqList(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
48
src/entities/support/model/types.ts
Normal file
48
src/entities/support/model/types.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { DefaulResponsePagination } from '@/entities/common/model/types';
|
||||
|
||||
export interface SupportParams {
|
||||
mid?: string;
|
||||
};
|
||||
export interface FaqListParams {
|
||||
category: string;
|
||||
searchValue: string;
|
||||
};
|
||||
export interface FaqListItemProps {
|
||||
sortNo: string;
|
||||
seq: string;
|
||||
category: string;
|
||||
categoryName: string;
|
||||
title: string;
|
||||
contents: string;
|
||||
};
|
||||
export interface FaqListResponse extends DefaulResponsePagination {
|
||||
content: Array<FaqListItemProps>;
|
||||
};
|
||||
export interface CounselListParams extends SupportParams {
|
||||
|
||||
};
|
||||
export interface CounselListItemProps {
|
||||
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 CounselSaveParams extends SupportParams {
|
||||
counselType: string;
|
||||
requestName: string;
|
||||
requestTel: string;
|
||||
requestEmail: string;
|
||||
title: string;
|
||||
contents: string;
|
||||
};
|
||||
export interface CounselSaveResponse {
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user