css 수정 홈 api payment api
This commit is contained in:
29
src/entities/home/api/use-home-banner-list-mutation.ts
Normal file
29
src/entities/home/api/use-home-banner-list-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_HOME } from '@/shared/api/api-url-home';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
HomeBannerListParams,
|
||||
HomeBannerListResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const homeBannerList = (params: HomeBannerListParams) => {
|
||||
return resultify(
|
||||
axios.post<HomeBannerListResponse>(API_URL_HOME.homeBannerList(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useHomeBannerListMutation = (options?: UseMutationOptions<HomeBannerListResponse, CBDCAxiosError, HomeBannerListParams>) => {
|
||||
const mutation = useMutation<HomeBannerListResponse, CBDCAxiosError, HomeBannerListParams>({
|
||||
...options,
|
||||
mutationFn: (params: HomeBannerListParams) => homeBannerList(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
29
src/entities/home/api/use-home-groups-mutation.ts
Normal file
29
src/entities/home/api/use-home-groups-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_HOME } from '@/shared/api/api-url-home';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
HomeGroupsParams,
|
||||
HomeGroupsResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const homeGroups = (params: HomeGroupsParams) => {
|
||||
return resultify(
|
||||
axios.post<HomeGroupsResponse>(API_URL_HOME.homeGroups(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useHomeGroupsMutation = (options?: UseMutationOptions<HomeGroupsResponse, CBDCAxiosError, HomeGroupsParams>) => {
|
||||
const mutation = useMutation<HomeGroupsResponse, CBDCAxiosError, HomeGroupsParams>({
|
||||
...options,
|
||||
mutationFn: (params: HomeGroupsParams) => homeGroups(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
29
src/entities/home/api/use-home-month-mutation.ts
Normal file
29
src/entities/home/api/use-home-month-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_HOME } from '@/shared/api/api-url-home';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
HomeMonthParams,
|
||||
HomeMonthResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const homeMonth = (params: HomeMonthParams) => {
|
||||
return resultify(
|
||||
axios.post<HomeMonthResponse>(API_URL_HOME.homeMonth(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useHomeMonthwMutation = (options?: UseMutationOptions<HomeMonthResponse, CBDCAxiosError, HomeMonthParams>) => {
|
||||
const mutation = useMutation<HomeMonthResponse, CBDCAxiosError, HomeMonthParams>({
|
||||
...options,
|
||||
mutationFn: (params: HomeMonthParams) => homeMonth(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
29
src/entities/home/api/use-home-notice-list-mutation.ts
Normal file
29
src/entities/home/api/use-home-notice-list-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_HOME } from '@/shared/api/api-url-home';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
HomeNoticeListParams,
|
||||
HomeNoticeListResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const homeNoticeList = (params: HomeNoticeListParams) => {
|
||||
return resultify(
|
||||
axios.post<HomeNoticeListResponse>(API_URL_HOME.homeBannerList(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useHomeBannerListMutation = (options?: UseMutationOptions<HomeNoticeListResponse, CBDCAxiosError, HomeNoticeListParams>) => {
|
||||
const mutation = useMutation<HomeNoticeListResponse, CBDCAxiosError, HomeNoticeListParams>({
|
||||
...options,
|
||||
mutationFn: (params: HomeNoticeListParams) => homeNoticeList(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
29
src/entities/home/api/use-home-overview-mutation.ts
Normal file
29
src/entities/home/api/use-home-overview-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_HOME } from '@/shared/api/api-url-home';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
HomeOverviewParams,
|
||||
HomeOverviewResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const homeOverview = (params: HomeOverviewParams) => {
|
||||
return resultify(
|
||||
axios.post<HomeOverviewResponse>(API_URL_HOME.homeOverview(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useHomeOverviewMutation = (options?: UseMutationOptions<HomeOverviewResponse, CBDCAxiosError, HomeOverviewParams>) => {
|
||||
const mutation = useMutation<HomeOverviewResponse, CBDCAxiosError, HomeOverviewParams>({
|
||||
...options,
|
||||
mutationFn: (params: HomeOverviewParams) => homeOverview(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
29
src/entities/home/api/use-home-today-mutation.ts
Normal file
29
src/entities/home/api/use-home-today-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_HOME } from '@/shared/api/api-url-home';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
HomeTodayParams,
|
||||
HomeTodayResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const homeToday = (params: HomeTodayParams) => {
|
||||
return resultify(
|
||||
axios.post<HomeTodayResponse>(API_URL_HOME.homeToday(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useHomeTodayMutation = (options?: UseMutationOptions<HomeTodayResponse, CBDCAxiosError, HomeTodayParams>) => {
|
||||
const mutation = useMutation<HomeTodayResponse, CBDCAxiosError, HomeTodayParams>({
|
||||
...options,
|
||||
mutationFn: (params: HomeTodayParams) => homeToday(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -1,3 +1,8 @@
|
||||
import {
|
||||
NoticeListParams,
|
||||
NoticeListResponse
|
||||
} from '@/entities/support/model/types';
|
||||
|
||||
export interface FavoriteItemProps {
|
||||
img?: string,
|
||||
text?: string
|
||||
@@ -9,4 +14,74 @@ export interface HomeBottomBannerProps {
|
||||
export interface AuthRegisterProps {
|
||||
setAuthRegisterOn: (authRegisterOn: boolean) => void;
|
||||
authRegisterOn: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
export interface HomeCommonParams {
|
||||
mid: string;
|
||||
searchDate: string;
|
||||
};
|
||||
export interface HomeTodayParams extends HomeCommonParams {};
|
||||
export interface HomeTodayResponse {
|
||||
sales: Sales,
|
||||
settlement: Settlement
|
||||
};
|
||||
export interface Sales {
|
||||
todayTotalAmount?: number;
|
||||
yesterdayTotalAmount?: number;
|
||||
totalCount?: number;
|
||||
cancelCount?: number;
|
||||
currentMonthAmount?: number;
|
||||
previousMonthAmount?: number;
|
||||
};
|
||||
export interface Settlement {
|
||||
todaySettlementAmount: number;
|
||||
totalCreditLimit: number;
|
||||
availableCredit: number;
|
||||
currentMonthSettlementAmount?: number;
|
||||
previousMonthSettlementAmount?: number;
|
||||
};
|
||||
export interface HomeOverviewParams extends HomeCommonParams {};
|
||||
export interface HomeOverviewResponse {
|
||||
averageTransactionAmount: number;
|
||||
dailyAverageSales: number;
|
||||
dailyAverageCount: number;
|
||||
topSalesDayInfo: TopSalesDayInfo;
|
||||
topSalesTimeInfo: TopSalesTimeInfo;
|
||||
topPaymentMethodInfo: TopPaymentMethodInfo;
|
||||
};
|
||||
export interface TopSalesDayInfo {
|
||||
daySalesRatios: Array<DaySalesRatios>;
|
||||
};
|
||||
export interface TopSalesTimeInfo {
|
||||
timeSalesRatios: Array<TimeSalesRatios>;
|
||||
};
|
||||
export interface TopPaymentMethodInfo {
|
||||
paymentMethodRatios: Array<PaymentMethodRatios>;
|
||||
};
|
||||
export interface DaySalesRatios {
|
||||
dayOfWeek: string;
|
||||
ratio: number;
|
||||
};
|
||||
export interface TimeSalesRatios {
|
||||
hour: string;
|
||||
ratio: number;
|
||||
};
|
||||
export interface PaymentMethodRatios {
|
||||
paymentMethod: string;
|
||||
ratio: number;
|
||||
};
|
||||
export interface HomeNoticeListParams extends NoticeListParams {};
|
||||
export interface HomeNoticeListResponse extends NoticeListResponse {};
|
||||
export interface HomeMonthParams extends HomeCommonParams {};
|
||||
export interface HomeMonthResponse {
|
||||
sales: Sales;
|
||||
settlement: Settlement;
|
||||
};
|
||||
export interface HomeGroupsParams {
|
||||
userid: string;
|
||||
};
|
||||
export interface HomeGroupsResponse {
|
||||
mids: Array<string>;
|
||||
};
|
||||
export interface HomeBannerListParams {};
|
||||
export interface HomeBannerListResponse {};
|
||||
Reference in New Issue
Block a user