Add permission checks to SMS payment pages
- Add grant check (57, 'D') to SMS payment download button - Add grant check (57, 'X') to SMS resend button - Refactor onClick handlers for better code organization Changes: - sms-payment-page: Add permission check for download, move onClick to button - sms-payment-detail-resend: Add imports for permission check functions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,8 @@ import { SmsPaymentDetailResendProps } from '../../../additional-service/model/s
|
|||||||
import { useExtensionSmsResendMutation } from '../../api/sms-payment/use-extension-sms-resend-mutation';
|
import { useExtensionSmsResendMutation } from '../../api/sms-payment/use-extension-sms-resend-mutation';
|
||||||
import appBridge from '@/shared/lib/appBridge';
|
import appBridge from '@/shared/lib/appBridge';
|
||||||
import { snackBar } from '@/shared/lib';
|
import { snackBar } from '@/shared/lib';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
|
||||||
export const SmsPaymentDetailResend = ({
|
export const SmsPaymentDetailResend = ({
|
||||||
bottomSmsPaymentDetailResendOn,
|
bottomSmsPaymentDetailResendOn,
|
||||||
@@ -22,6 +24,10 @@ export const SmsPaymentDetailResend = ({
|
|||||||
const {mutateAsync : resendMessage } = useExtensionSmsResendMutation();
|
const {mutateAsync : resendMessage } = useExtensionSmsResendMutation();
|
||||||
|
|
||||||
const onClickResend = () => {
|
const onClickResend = () => {
|
||||||
|
if (!checkGrant(57, 'X')) {
|
||||||
|
showAlert(t('common.nopermission'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
// sendMessage가 없으면 재발송 불가
|
// sendMessage가 없으면 재발송 불가
|
||||||
if (!smsDetailData?.sendMessage) {
|
if (!smsDetailData?.sendMessage) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
|||||||
import { useExtensionAccessCheck } from '@/shared/lib/hooks/use-extension-access-check';
|
import { useExtensionAccessCheck } from '@/shared/lib/hooks/use-extension-access-check';
|
||||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||||
import { set } from 'lodash-es';
|
import { set } from 'lodash-es';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
|
||||||
export const SmsPaymentPage = () => {
|
export const SmsPaymentPage = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -135,6 +137,10 @@ export const SmsPaymentPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onClickToOpenEmailBottomSheet = () => {
|
const onClickToOpenEmailBottomSheet = () => {
|
||||||
|
if (!checkGrant(57, 'D')) {
|
||||||
|
showAlert(t('common.nopermission'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
setEmailBottomSheetOn(true);
|
setEmailBottomSheetOn(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -209,11 +215,11 @@ export const SmsPaymentPage = () => {
|
|||||||
<button
|
<button
|
||||||
className="download-btn"
|
className="download-btn"
|
||||||
aria-label="다운로드"
|
aria-label="다운로드"
|
||||||
|
onClick={onClickToOpenEmailBottomSheet}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src={IMAGE_ROOT + '/ico_download.svg'}
|
src={IMAGE_ROOT + '/ico_download.svg'}
|
||||||
alt="다운로드"
|
alt="다운로드"
|
||||||
onClick={() => onClickToOpenEmailBottomSheet()}
|
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user