v1.0.43 - use OCS controller
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* MinimalProfile v41 - API-based config
|
||||
* MinimalProfile v42 - OCS API
|
||||
*/
|
||||
(function() {
|
||||
'use strict';
|
||||
@@ -8,7 +8,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('MinimalProfile v41: Starting');
|
||||
console.log('MinimalProfile v42: Starting');
|
||||
|
||||
var map = {
|
||||
'pronouns': '#account-property-pronouns',
|
||||
@@ -36,22 +36,22 @@
|
||||
|
||||
function loadConfig() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', '/apps/minimalprofile/api/v1/hidden-fields', true);
|
||||
xhr.open('GET', '/ocs/v2.php/apps/minimalprofile/api/v1/hidden-fields', true);
|
||||
xhr.onload = function() {
|
||||
if (xhr.status === 200) {
|
||||
try {
|
||||
var data = JSON.parse(xhr.responseText);
|
||||
console.log('MinimalProfile v41: API returned', data.hiddenFields);
|
||||
hideFields(data.hiddenFields);
|
||||
console.log('MinimalProfile v42: API returned', data.ocs.data.hiddenFields);
|
||||
hideFields(data.ocs.data.hiddenFields);
|
||||
} catch(e) {
|
||||
console.error('MinimalProfile v41: JSON parse error', e);
|
||||
console.error('MinimalProfile v42: JSON parse error', e);
|
||||
}
|
||||
} else {
|
||||
console.error('MinimalProfile v41: API failed', xhr.status);
|
||||
console.error('MinimalProfile v42: API failed', xhr.status);
|
||||
}
|
||||
};
|
||||
xhr.onerror = function() {
|
||||
console.error('MinimalProfile v41: Network error');
|
||||
console.error('MinimalProfile v42: Network error');
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user