| @@ -1,55 +1,55 @@ | ||
| 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; | |
| 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; | |