Add permission check to key-in payment request button
- Add checkGrant(56, 'X') permission check to onClickToNavigate function - Show alert message when user lacks permission - Simplify onClick handler from arrow function to direct method reference 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,8 @@ import { ListDateGroup } from '../list-date-group';
|
|||||||
import { KeyInPaymentListItem, KeyInPaymentListProps } from '../../model/key-in/types';
|
import { KeyInPaymentListItem, KeyInPaymentListProps } from '../../model/key-in/types';
|
||||||
import { JSX } from 'react';
|
import { JSX } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
|
||||||
export const KeyInPaymentList = ({
|
export const KeyInPaymentList = ({
|
||||||
additionalServiceCategory,
|
additionalServiceCategory,
|
||||||
@@ -59,6 +61,10 @@ export const KeyInPaymentList = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onClickToNavigate = () => {
|
const onClickToNavigate = () => {
|
||||||
|
if (!checkGrant(56, 'X')) {
|
||||||
|
showAlert(t('common.nopermission'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
navigate(PATHS.additionalService.keyInPayment.request);
|
navigate(PATHS.additionalService.keyInPayment.request);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -70,7 +76,7 @@ export const KeyInPaymentList = ({
|
|||||||
<div className="apply-row">
|
<div className="apply-row">
|
||||||
<button
|
<button
|
||||||
className="btn-50 btn-blue flex-1"
|
className="btn-50 btn-blue flex-1"
|
||||||
onClick={() => onClickToNavigate()}
|
onClick={onClickToNavigate}
|
||||||
>{t('additionalService.linkPay.paymentRequest')}</button>
|
>{t('additionalService.linkPay.paymentRequest')}</button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user