addonspage.js
34 lines
| 1 | export default class AddonsPage { |
| 2 | |
| 3 | constructor(){ |
| 4 | |
| 5 | if( ! jQuery( 'body' ).hasClass( 'wpm-testimonial_page_strong-testimonials-addons' ) ) { |
| 6 | return; |
| 7 | } |
| 8 | |
| 9 | this.reloadButton = jQuery('#wpmtst-reload-extensions'); |
| 10 | |
| 11 | //events |
| 12 | this.reloadButton.on('click', (e) => this.onReloadExtensionsClick(e) ); |
| 13 | } |
| 14 | |
| 15 | onReloadExtensionsClick(e) { |
| 16 | e.preventDefault(); |
| 17 | |
| 18 | this.reloadButton.addClass( 'updating-message' ); |
| 19 | |
| 20 | jQuery.ajax({ |
| 21 | type: "POST", |
| 22 | data : { action: "wpmtst_reload_extensions", nonce: this.reloadButton.data('nonce') }, |
| 23 | url : ajaxurl, |
| 24 | success: function( response ) { |
| 25 | location.reload(); |
| 26 | } |
| 27 | }); |
| 28 | } |
| 29 | |
| 30 | |
| 31 | } |
| 32 | |
| 33 | |
| 34 |