PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.7
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.7
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 4.2.0 4.2.1 All 138 releases
learnpress / assets / src / apps / js / admin / editor / actions / course.js

course.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.7, at assets/src/apps/js/admin/editor/actions/course.js

56 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 const Course = {
2 heartbeat: function( context ) {
3 LP.Request( {
4 type: 'heartbeat',
5 } ).then(
6 function( response ) {
7 var result = response.body;
8 context.commit( 'UPDATE_HEART_BEAT', !! result.success );
9 },
10 function( error ) {
11 context.commit( 'UPDATE_HEART_BEAT', false );
12 }
13 );
14 },
15
16 draftCourse: function( context, payload ) {
17 var auto_draft = context.getters.autoDraft;
18
19 if ( auto_draft ) {
20 LP.Request( {
21 type: 'draft-course',
22 course: JSON.stringify( payload ),
23 } ).then( function( response ) {
24 var result = response.body;
25
26 if ( ! result.success ) {
27 return;
28 }
29
30 context.commit( 'UPDATE_AUTO_DRAFT_STATUS', false );
31 }
32 );
33 }
34 },
35
36 newRequest: function( context ) {
37 context.commit( 'INCREASE_NUMBER_REQUEST' );
38 context.commit( 'UPDATE_STATUS', 'loading' );
39
40 window.onbeforeunload = function() {
41 return '';
42 };
43 },
44
45 requestCompleted: function( context, status ) {
46 context.commit( 'DECREASE_NUMBER_REQUEST' );
47
48 if ( context.getters.currentRequest === 0 ) {
49 context.commit( 'UPDATE_STATUS', status );
50 window.onbeforeunload = null;
51 }
52 },
53 };
54
55 export default Course;
56