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 { JSX } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
export const KeyInPaymentList = ({
|
||||
additionalServiceCategory,
|
||||
@@ -59,6 +61,10 @@ export const KeyInPaymentList = ({
|
||||
};
|
||||
|
||||
const onClickToNavigate = () => {
|
||||
if (!checkGrant(56, 'X')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
navigate(PATHS.additionalService.keyInPayment.request);
|
||||
};
|
||||
|
||||
@@ -70,7 +76,7 @@ export const KeyInPaymentList = ({
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={() => onClickToNavigate()}
|
||||
onClick={onClickToNavigate}
|
||||
>{t('additionalService.linkPay.paymentRequest')}</button>
|
||||
</div>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user