첫 커밋
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
CodesCacheRefreshByCodeClParams,
|
||||
CodesCacheRefreshByCodeClResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const codesCacheRefreshByCodeCl = ({
|
||||
codeCl
|
||||
}: CodesCacheRefreshByCodeClParams) => {
|
||||
return resultify(
|
||||
axios.post<CodesCacheRefreshByCodeClResponse>(API_URL.codesCacheRefreshByCodelCl(codeCl)),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCodesCacheRefreshByCodeClMutation = (options?: UseMutationOptions<CodesCacheRefreshByCodeClResponse, CBDCAxiosError, CodesCacheRefreshByCodeClParams>) => {
|
||||
const mutation = useMutation<CodesCacheRefreshByCodeClResponse, CBDCAxiosError, CodesCacheRefreshByCodeClParams>({
|
||||
...options,
|
||||
mutationFn: ({
|
||||
codeCl
|
||||
}: CodesCacheRefreshByCodeClParams) => codesCacheRefreshByCodeCl({
|
||||
codeCl
|
||||
}),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
26
src/entities/common/api/use-codes-cache-refresh-mutation.ts
Normal file
26
src/entities/common/api/use-codes-cache-refresh-mutation.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import { CodesCacheRefreshResponse } from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const codesCacheRefresh = () => {
|
||||
return resultify(
|
||||
axios.post<CodesCacheRefreshResponse>(API_URL.counselList()),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCodesCacheRefreshMutation = (options?: UseMutationOptions<CodesCacheRefreshResponse, CBDCAxiosError>) => {
|
||||
const mutation = useMutation<CodesCacheRefreshResponse, CBDCAxiosError>({
|
||||
...options,
|
||||
mutationFn: () => codesCacheRefresh(),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
26
src/entities/common/api/use-codes-cache-status-mutaion.ts
Normal file
26
src/entities/common/api/use-codes-cache-status-mutaion.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import { CodesCacheStatusResponse } from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const codesCacheStatus = () => {
|
||||
return resultify(
|
||||
axios.get<CodesCacheStatusResponse>(API_URL.codesCacheStatus()),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCodesGroupByCodeClMutation = (options?: UseMutationOptions<CodesCacheStatusResponse, CBDCAxiosError>) => {
|
||||
const mutation = useMutation<CodesCacheStatusResponse, CBDCAxiosError>({
|
||||
...options,
|
||||
mutationFn: () => codesCacheStatus(),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
33
src/entities/common/api/use-codes-group-by-codeCl-mutaion.ts
Normal file
33
src/entities/common/api/use-codes-group-by-codeCl-mutaion.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
CodesGroupByCodeClParams,
|
||||
CodesGroupByCodeClResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const codesGroupByCodeCl = ({ codeCl }: CodesGroupByCodeClParams) => {
|
||||
return resultify(
|
||||
axios.get<CodesGroupByCodeClResponse>(API_URL.codesGroupByCodeCl(codeCl)),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCodesGroupByCodeClMutation = (options?: UseMutationOptions<CodesGroupByCodeClResponse, CBDCAxiosError, CodesGroupByCodeClParams>) => {
|
||||
const mutation = useMutation<CodesGroupByCodeClResponse, CBDCAxiosError, CodesGroupByCodeClParams>({
|
||||
...options,
|
||||
mutationFn: ({
|
||||
codeCl
|
||||
}: CodesGroupByCodeClParams) => codesGroupByCodeCl({
|
||||
codeCl
|
||||
}),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
33
src/entities/common/api/use-codes-list-by-codeCl-mutaion.ts
Normal file
33
src/entities/common/api/use-codes-list-by-codeCl-mutaion.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
CodesListByCodeClParams,
|
||||
CodesListByCodeClResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const codesListByCodeCl = ({ codeCl }: CodesListByCodeClParams) => {
|
||||
return resultify(
|
||||
axios.get<CodesListByCodeClResponse>(API_URL.codesListByCodeCl(codeCl)),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCodesListByCodeClMutation = (options?: UseMutationOptions<CodesListByCodeClResponse, CBDCAxiosError, CodesListByCodeClParams>) => {
|
||||
const mutation = useMutation<CodesListByCodeClResponse, CBDCAxiosError, CodesListByCodeClParams>({
|
||||
...options,
|
||||
mutationFn: ({
|
||||
codeCl
|
||||
}: CodesListByCodeClParams) => codesListByCodeCl({
|
||||
codeCl
|
||||
}),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
64
src/entities/common/api/use-codes-select-mutation.ts
Normal file
64
src/entities/common/api/use-codes-select-mutation.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
CodesSelectParams,
|
||||
CodesSelectGetResponse,
|
||||
CodesSelectPostResponse,
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const codesSelect = ({
|
||||
codeCl,
|
||||
colNm,
|
||||
code1,
|
||||
code2,
|
||||
useCl,
|
||||
method
|
||||
}: CodesSelectParams) => {
|
||||
if(method === 'get'){
|
||||
return resultify(
|
||||
axios.get<CodesSelectGetResponse>(API_URL.codesSelect()),
|
||||
);
|
||||
}
|
||||
else{
|
||||
return resultify(
|
||||
axios.post<CodesSelectPostResponse>(API_URL.codesSelect(), {
|
||||
codeCl,
|
||||
colNm,
|
||||
code1,
|
||||
code2,
|
||||
useCl
|
||||
}),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export const useCodesSelectMutation = (options?: UseMutationOptions<CodesSelectGetResponse | CodesSelectPostResponse, CBDCAxiosError, CodesSelectParams>) => {
|
||||
const mutation = useMutation<CodesSelectGetResponse | CodesSelectPostResponse, CBDCAxiosError, CodesSelectParams>({
|
||||
...options,
|
||||
mutationFn: ({
|
||||
codeCl,
|
||||
colNm,
|
||||
code1,
|
||||
code2,
|
||||
useCl,
|
||||
method
|
||||
}: CodesSelectParams) => codesSelect({
|
||||
codeCl,
|
||||
colNm,
|
||||
code1,
|
||||
code2,
|
||||
useCl,
|
||||
method
|
||||
}),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -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 {
|
||||
EmptyTokenAddSendCodeParams,
|
||||
EmptyTokenAddSendCodeResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const emptyTokenAddSendCode = (params: EmptyTokenAddSendCodeParams) => {
|
||||
return resultify(
|
||||
axios.post<EmptyTokenAddSendCodeResponse>(API_URL.emptyTokenFindSendCode(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useEmptyTokenAddSendCodeMutation = (options?: UseMutationOptions<EmptyTokenAddSendCodeResponse, CBDCAxiosError, EmptyTokenAddSendCodeParams>) => {
|
||||
const mutation = useMutation<EmptyTokenAddSendCodeResponse, CBDCAxiosError, EmptyTokenAddSendCodeParams>({
|
||||
...options,
|
||||
mutationFn: (params: EmptyTokenAddSendCodeParams) => emptyTokenAddSendCode(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
29
src/entities/common/api/use-empty-token-change-mutation.ts
Normal file
29
src/entities/common/api/use-empty-token-change-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 {
|
||||
EmptyTokenChangeParams,
|
||||
EmptyTokenChangeResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const emptyTokenChange = (params: EmptyTokenChangeParams) => {
|
||||
return resultify(
|
||||
axios.post<EmptyTokenChangeResponse>(API_URL.emptyTokenChange(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useEmptyTokenChangeMutation = (options?: UseMutationOptions<EmptyTokenChangeResponse, CBDCAxiosError, EmptyTokenChangeParams>) => {
|
||||
const mutation = useMutation<EmptyTokenChangeResponse, CBDCAxiosError, EmptyTokenChangeParams>({
|
||||
...options,
|
||||
mutationFn: (params: EmptyTokenChangeParams) => emptyTokenChange(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -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 {
|
||||
EmptyTokenFindSendCodeParams,
|
||||
EmptyTokenFindSendCodeResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const emptyTokenFindSendCode = (params: EmptyTokenFindSendCodeParams) => {
|
||||
return resultify(
|
||||
axios.post<EmptyTokenFindSendCodeResponse>(API_URL.emptyTokenFindSendCode(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useEmptyTokenFindSendCodeMutation = (options?: UseMutationOptions<EmptyTokenFindSendCodeResponse, CBDCAxiosError, EmptyTokenFindSendCodeParams>) => {
|
||||
const mutation = useMutation<EmptyTokenFindSendCodeResponse, CBDCAxiosError, EmptyTokenFindSendCodeParams>({
|
||||
...options,
|
||||
mutationFn: (params: EmptyTokenFindSendCodeParams) => emptyTokenFindSendCode(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -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 {
|
||||
EmptyTokenVerifyCodeParams,
|
||||
EmptyTokenVerifyCodeResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const emptyTokenVerifyCode = (params: EmptyTokenVerifyCodeParams) => {
|
||||
return resultify(
|
||||
axios.post<EmptyTokenVerifyCodeResponse>(API_URL.emptyTokenVerifyCode(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useEmptyTokenVerifyCodeMutation = (options?: UseMutationOptions<EmptyTokenVerifyCodeResponse, CBDCAxiosError, EmptyTokenVerifyCodeParams>) => {
|
||||
const mutation = useMutation<EmptyTokenVerifyCodeResponse, CBDCAxiosError, EmptyTokenVerifyCodeParams>({
|
||||
...options,
|
||||
mutationFn: (params: EmptyTokenVerifyCodeParams) => emptyTokenVerifyCode(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user