PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.7.2
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.7.2
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 4.2.0 All 139 releases
learnpress / assets / src / apps / js / frontend / profile / statistic.js

statistic.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.1.7.2, at assets/src/apps/js/frontend/profile/statistic.js

37 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { addQueryArgs } from '@wordpress/url';
2
3 // Rest API load content course progress - Nhamdv.
4 const courseStatistics = () => {
5 const elements = document.querySelector( '.learn-press-profile-course__statistic' );
6
7 if ( ! elements ) {
8 return;
9 }
10
11 const getResponse = ( ele, dataset ) => {
12 wp.apiFetch( {
13 path: addQueryArgs( 'lp/v1/profile/statistic', dataset ),
14 method: 'GET',
15 } ).then( ( response ) => {
16 if ( response.status === 'success' && response.data ) {
17 ele.innerHTML = response.data;
18 } else {
19 ele.innerHTML = `<div class="lp-ajax-message error" style="display:block">${ response.message && response.message }</div>`;
20 }
21 } ).catch( ( err ) => {
22 console.log( err );
23 //ele.innerHTML += `<div class="lp-ajax-message error" style="display:block">${ err.message && err.message }</div>`;
24 } );
25 };
26
27 const elArgStatistic = document.querySelector( '[name="args_query_user_courses_statistic"]' );
28 if ( ! elArgStatistic ) {
29 return;
30 }
31
32 const data = JSON.parse( elArgStatistic.value );
33
34 getResponse( elements, data );
35 };
36 export default courseStatistics;
37