mid 변경

This commit is contained in:
focp212@naver.com
2025-10-30 10:57:52 +09:00
parent e4e73dec72
commit 506f6c0acf
7 changed files with 56 additions and 14 deletions

View File

@@ -77,6 +77,7 @@ export interface HeaderNavigationProps {
setMenuOn: (menuOn: boolean) => void;
favoriteEdit?: boolean;
loginSuccess: boolean;
mid?: string;
setMid: (mid: string) => void;
};

View File

@@ -15,8 +15,11 @@ export const InfoWrap = () => {
const { t } = useTranslation();
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
const userMid = useStore.getState().UserStore.mid;
let midItem = midOptionsWithoutGids.filter((value, index) => {
return value.value === userMid;
});
const [mid, setMid] = useState<string>(userMid);
const [mid, setMid] = useState<string>((midItem.length > 0)? userMid: '');
const [data, setData] = useState<MerchantMidResponse>();
const [openChild, setOpenChild] = useState<SectionKeys | null>(null);

View File

@@ -17,10 +17,13 @@ import { useStore } from '@/shared/model/store';
export const RegistrationStatusWrap = () => {
const { t } = useTranslation();
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
const midOptions = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
const userMid = useStore.getState().UserStore.mid;
let midItem = midOptions.filter((value, index) => {
return value.value === userMid;
});
const [mid, setMid] = useState<string>(userMid);
const [mid, setMid] = useState<string>((midItem.length > 0)? userMid: '');
const [onlineInfomation, setOnlineInfomation] = useState<OnlineInfomation>();
const [offlineInfomation, setOfflineInfomation] = useState<OfflineInfomation>();
const [cardApplications, setCardApplications] = useState<Array<CardApplications>>();
@@ -55,7 +58,7 @@ export const RegistrationStatusWrap = () => {
onChange={ (e: ChangeEvent<HTMLSelectElement>) => setMid(e.target.value) }
>
{
midOptionsWithoutGids.map((value, index) => (
midOptions.map((value, index) => (
<option
key={ value.value }
value={ value.value }

View File

@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { ChangeEvent, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { InfoItem } from './info-item';
@@ -32,11 +32,17 @@ import {
import { usePaymentCardMutation } from '../api/use-payment-card-mutation';
import { usePaymentNonCardMutation } from '../api/use-payment-non-card-mutation';
import { usePaymentInstallmentMutation } from '../api/use-payment-installment-mutation';
import { useStore } from '@/shared/model/store';
export const InfoWrap = () => {
const { t } = useTranslation();
const midOptions = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
const userMid = useStore.getState().UserStore.mid;
let midItem = midOptions.filter((value, index) => {
return value.value === userMid;
});
const [mid, setMid] = useState<string>('nictest00g');
const [mid, setMid] = useState<string>((midItem.length > 0)? userMid: '');
const [noInterestInfoBottomSheetOn, setNoInterestInfoBottomSheetOn] = useState<boolean>(false);
const [cardCommissionBottomSheetOn, setCardCommissionBottomSheetOn] = useState<boolean>(false);
@@ -203,16 +209,34 @@ export const InfoWrap = () => {
callPaymentIntallmentDetail(cardCompany);
};
useEffect(() => {
callPaymentCard();
callPaymentNonCard();
callPaymentIntallment();
callPaymentIntallmentDetail(cardCompany);
}, []);
if(mid){
callPaymentCard();
callPaymentNonCard();
callPaymentIntallment();
callPaymentIntallmentDetail(cardCompany);
}
}, [mid]);
return (
<>
<div
className="input-wrapper top-select mt-30"
style={{ paddingBottom: 0}}
>
<select
value={ mid }
onChange={ (e: ChangeEvent<HTMLSelectElement>) => setMid(e.target.value) }
>
{
midOptions.map((value, index) => (
<option
key={ value.value }
value={ value.value }
>{ value.name }</option>
))
}
</select>
</div>
<div className="ing-list">
<div className="ing-title">{t('payment.serviceUsageCommissionAndSettlement')}</div>
<ul className="ing-card-list">

View File

@@ -15,7 +15,15 @@ export const FilterSelectMid = ({
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
const userMid = useStore.getState().UserStore.mid;
const [filterMid, setFilterMid] = useState<string>(userMid);
let options = midOptions;
if(showType === 'MID'){
options = midOptionsWithoutGids;
}
let midItem = options.filter((value, index) => {
return value.value === userMid;
});
const [filterMid, setFilterMid] = useState<string>((midItem.length > 0)? userMid: '');
const getSelectMidOptions = () => {
let rs = [];

View File

@@ -20,6 +20,7 @@ export const HeaderNavigation = ({
setMenuOn,
favoriteEdit,
loginSuccess,
mid,
setMid
}: HeaderNavigationProps) => {
const { mutateAsync: appAlarmUnreadCount } = useAppAlarmUnreadCountMutation();
@@ -111,6 +112,7 @@ export const HeaderNavigation = ({
<select
className="heading-select"
onChange={ onChangeToMid }
value={ mid }
>
{ selectOptions && selectOptions.length > 0 &&
selectOptions.map((value, index) => (

View File

@@ -361,6 +361,7 @@ export const SubLayout = () => {
favoriteEdit={ favoriteEdit }
key={ headerNavigationKey }
loginSuccess={ loginSuccess }
mid={ mid }
setMid={ setMid }
/>
{ loginSuccess &&