css 수정 홈 api payment api
This commit is contained in:
29
src/entities/payment/api/use-payment-card-mutaion.ts
Normal file
29
src/entities/payment/api/use-payment-card-mutaion.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_PAYMENT } from '@/shared/api/api-url-payment';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
PaymentCardParams,
|
||||
PaymentCardResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const paymentCard = (params: PaymentCardParams) => {
|
||||
return resultify(
|
||||
axios.post<PaymentCardResponse>(API_URL_PAYMENT.paymentCard(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const usePaymentCardMutation = (options?: UseMutationOptions<PaymentCardResponse, CBDCAxiosError, PaymentCardParams>) => {
|
||||
const mutation = useMutation<PaymentCardResponse, CBDCAxiosError, PaymentCardParams>({
|
||||
...options,
|
||||
mutationFn: (params: PaymentCardParams) => paymentCard(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_PAYMENT } from '@/shared/api/api-url-payment';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
PaymentInstallmentDetailParams,
|
||||
PaymentInstallmentDetailResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const paymentInstallmentDetail = (params: PaymentInstallmentDetailParams) => {
|
||||
return resultify(
|
||||
axios.post<PaymentInstallmentDetailResponse>(API_URL_PAYMENT.paymentInstallmentDetail(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const usePaymentInstallmentDetailMutation = (options?: UseMutationOptions<PaymentInstallmentDetailResponse, CBDCAxiosError, PaymentInstallmentDetailParams>) => {
|
||||
const mutation = useMutation<PaymentInstallmentDetailResponse, CBDCAxiosError, PaymentInstallmentDetailParams>({
|
||||
...options,
|
||||
mutationFn: (params: PaymentInstallmentDetailParams) => paymentInstallmentDetail(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
29
src/entities/payment/api/use-payment-installment-mutaion.ts
Normal file
29
src/entities/payment/api/use-payment-installment-mutaion.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_PAYMENT } from '@/shared/api/api-url-payment';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
PaymentInstallmentParams,
|
||||
PaymentInstallmentResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const paymentInstallment = (params: PaymentInstallmentParams) => {
|
||||
return resultify(
|
||||
axios.post<PaymentInstallmentResponse>(API_URL_PAYMENT.paymentInstallment(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const usePaymentInstallmentMutation = (options?: UseMutationOptions<PaymentInstallmentResponse, CBDCAxiosError, PaymentInstallmentParams>) => {
|
||||
const mutation = useMutation<PaymentInstallmentResponse, CBDCAxiosError, PaymentInstallmentParams>({
|
||||
...options,
|
||||
mutationFn: (params: PaymentInstallmentParams) => paymentInstallment(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
29
src/entities/payment/api/use-payment-non-card-mutation.ts
Normal file
29
src/entities/payment/api/use-payment-non-card-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_PAYMENT } from '@/shared/api/api-url-payment';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
PaymentNonCardParams,
|
||||
PaymentNonCardResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const paymentNonCard = (params: PaymentNonCardParams) => {
|
||||
return resultify(
|
||||
axios.post<PaymentNonCardResponse>(API_URL_PAYMENT.paymentNonCard(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const usePaymentNonCardMutation = (options?: UseMutationOptions<PaymentNonCardResponse, CBDCAxiosError, PaymentNonCardParams>) => {
|
||||
const mutation = useMutation<PaymentNonCardResponse, CBDCAxiosError, PaymentNonCardParams>({
|
||||
...options,
|
||||
mutationFn: (params: PaymentNonCardParams) => paymentNonCard(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_PAYMENT } from '@/shared/api/api-url-payment';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
PaymentNotificationDataParams,
|
||||
PaymentNotificationDataResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const paymentNotificationData = (params: PaymentNotificationDataParams) => {
|
||||
return resultify(
|
||||
axios.post<PaymentNotificationDataResponse>(API_URL_PAYMENT.paymentnotificationData(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const usePaymentNotificationDataMutation = (options?: UseMutationOptions<PaymentNotificationDataResponse, CBDCAxiosError, PaymentNotificationDataParams>) => {
|
||||
const mutation = useMutation<PaymentNotificationDataResponse, CBDCAxiosError, PaymentNotificationDataParams>({
|
||||
...options,
|
||||
mutationFn: (params: PaymentNotificationDataParams) => paymentNotificationData(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user