PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | assets/src/apps/js/admin/editor/http.js +65 -65 4.3.8 → 4.4.9 View file →
@@ -1,65 +1,65 @@
1 -export default function HTTP( options ) {
2 - const $ = window.jQuery || jQuery;
3 - const $VueHTTP = Vue.http;
4 -
5 - options = $.extend( {
6 - ns: 'LPRequest',
7 - store: false,
8 - }, options || {} );
9 -
10 - let $publishingAction = null;
11 -
12 - LP.Request = function( payload ) {
13 - $publishingAction = $( '#publishing-action' );
14 -
15 - payload.id = options.store.getters.id;
16 - payload.nonce = options.store.getters.nonce;
17 - payload[ 'lp-ajax' ] = options.store.getters.action;
18 - //payload.code = options.store.getters.code;
19 -
20 - $publishingAction.find( '#publish' ).addClass( 'disabled' );
21 - $publishingAction.find( '.spinner' ).addClass( 'is-active' );
22 - $publishingAction.addClass( 'code-' + payload.code );
23 -
24 - return $VueHTTP.post( options.store.getters.urlAjax,
25 - payload,
26 - {
27 - emulateJSON: true,
28 - params: {
29 - namespace: options.ns,
30 - code: payload.code,
31 - },
32 - } );
33 - };
34 -
35 - $VueHTTP.interceptors.push( function( request, next ) {
36 - if ( request.params.namespace !== options.ns ) {
37 - next();
38 - return;
39 - }
40 -
41 - options.store.dispatch( 'newRequest' );
42 -
43 - next( function( response ) {
44 - if ( ! jQuery.isPlainObject( response.body ) ) {
45 - response.body = LP.parseJSON( response.body );
46 - }
47 -
48 - const body = response.body;
49 - const result = body.success || false;
50 -
51 - if ( result ) {
52 - options.store.dispatch( 'requestCompleted', 'successful' );
53 - } else {
54 - options.store.dispatch( 'requestCompleted', 'failed' );
55 - }
56 -
57 - $publishingAction.removeClass( 'code-' + request.params.code );
58 -
59 - if ( ! $publishingAction.attr( 'class' ) ) {
60 - $publishingAction.find( '#publish' ).removeClass( 'disabled' );
61 - $publishingAction.find( '.spinner' ).removeClass( 'is-active' );
62 - }
63 - } );
64 - } );
65 -}
1 +export default function HTTP( options ) {
2 + const $ = window.jQuery || jQuery;
3 + const $VueHTTP = Vue.http;
4 +
5 + options = $.extend( {
6 + ns: 'LPRequest',
7 + store: false,
8 + }, options || {} );
9 +
10 + let $publishingAction = null;
11 +
12 + LP.Request = function( payload ) {
13 + $publishingAction = $( '#publishing-action' );
14 +
15 + payload.id = options.store.getters.id;
16 + payload.nonce = options.store.getters.nonce;
17 + payload[ 'lp-ajax' ] = options.store.getters.action;
18 + //payload.code = options.store.getters.code;
19 +
20 + $publishingAction.find( '#publish' ).addClass( 'disabled' );
21 + $publishingAction.find( '.spinner' ).addClass( 'is-active' );
22 + $publishingAction.addClass( 'code-' + payload.code );
23 +
24 + return $VueHTTP.post( options.store.getters.urlAjax,
25 + payload,
26 + {
27 + emulateJSON: true,
28 + params: {
29 + namespace: options.ns,
30 + code: payload.code,
31 + },
32 + } );
33 + };
34 +
35 + $VueHTTP.interceptors.push( function( request, next ) {
36 + if ( request.params.namespace !== options.ns ) {
37 + next();
38 + return;
39 + }
40 +
41 + options.store.dispatch( 'newRequest' );
42 +
43 + next( function( response ) {
44 + if ( ! jQuery.isPlainObject( response.body ) ) {
45 + response.body = LP.parseJSON( response.body );
46 + }
47 +
48 + const body = response.body;
49 + const result = body.success || false;
50 +
51 + if ( result ) {
52 + options.store.dispatch( 'requestCompleted', 'successful' );
53 + } else {
54 + options.store.dispatch( 'requestCompleted', 'failed' );
55 + }
56 +
57 + $publishingAction.removeClass( 'code-' + request.params.code );
58 +
59 + if ( ! $publishingAction.attr( 'class' ) ) {
60 + $publishingAction.find( '#publish' ).removeClass( 'disabled' );
61 + $publishingAction.find( '.spinner' ).removeClass( 'is-active' );
62 + }
63 + } );
64 + } );
65 +}