Skip to content

Commit

Permalink
fix js lint
Browse files Browse the repository at this point in the history
  • Loading branch information
manzurahammed committed May 1, 2024
1 parent 3d124d1 commit d39e32f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ export default function SubscriptionsExpiredNotice(): JSX.Element | null {
const wccomSettings = getAdminSetting( 'wccomHelper', {} );
const notice = wccomSettings?.subscription_expired_notice || {};

if (!wccomSettings.isConnected || !notice?.description) {
if ( ! wccomSettings.isConnected || ! notice?.description ) {
return null;
}

const handleClose = () => {
const data = {notice_id:'woo-subscription-expired-notice'}
const data = { notice_id: 'woo-subscription-expired-notice' };
apiFetch( {
path: `/wc-admin/woo_subscription_notice_dissmiss/`,
method: 'POST',
data,
} )
} );
};

return (
Expand All @@ -37,7 +37,7 @@ export default function SubscriptionsExpiredNotice(): JSX.Element | null {
onClose={ handleClose }
>
<Button href={ notice.button_link } variant="secondary">
{ __( notice.button_text, 'woocommerce' ) }
{ notice.button_text }
</Button>
</Notice>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
import apiFetch from "@wordpress/api-fetch";
import apiFetch from '@wordpress/api-fetch';

/**
* Internal dependencies
Expand All @@ -12,21 +12,20 @@ import Notice from '~/marketplace/components/notice/notice';
import { getAdminSetting } from '~/utils/admin-settings';

export default function SubscriptionsExpiringNotice(): JSX.Element | null {

const wccomSettings = getAdminSetting( 'wccomHelper', {} );
const notice = wccomSettings?.subscription_expiring_notice || {};

if (!wccomSettings.isConnected || !notice?.description) {
if ( ! wccomSettings.isConnected || ! notice?.description ) {
return null;
}

const handleClose = () => {
const data = {notice_id:'woo-subscription-expiring-notice'}
const data = { notice_id: 'woo-subscription-expiring-notice' };
apiFetch( {
path: `/wc-admin/woo_subscription_notice_dissmiss/`,
method: 'POST',
data,
} )
} );
};

return (
Expand All @@ -38,7 +37,7 @@ export default function SubscriptionsExpiringNotice(): JSX.Element | null {
onClose={ handleClose }
>
<Button href={ notice.button_link } variant="secondary">
{ __( notice.button_text, 'woocommerce' ) }
{ notice.button_text }
</Button>
</Notice>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
( function ( $ ) {
$( document ).on( 'click', '.woo-subscription-expiring-notice,.woo-subscription-expired-notice', function ( e ) {
const notice_id = this.id;
if ( !notice_id ) {
return;
}
$( document ).on(
'click',
'.woo-subscription-expiring-notice,.woo-subscription-expired-notice',
function () {
const notice_id = this.id;
if ( ! notice_id ) {
return;
}

var data = {
notice_id: notice_id,
};
const data = {
notice_id,
};

window.wp.apiFetch( {
path: `/wc-admin/woo_subscription_notice_dissmiss/`,
method: 'POST',
data,
} )
} )
} )( jQuery );
window.wp.apiFetch( {
path: `/wc-admin/woo_subscription_notice_dissmiss/`,
method: 'POST',
data,
} );
}
);
} )( window.jQuery );

0 comments on commit d39e32f

Please sign in to comment.