Fixing content type for sendBeacon
This commit is contained in:
@@ -950,15 +950,18 @@ export default class BaseAPI {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
let beacon;
|
const headers = {
|
||||||
|
type: this.settings.commitRequestDataType,
|
||||||
|
};
|
||||||
|
let blob;
|
||||||
if (params instanceof Array) {
|
if (params instanceof Array) {
|
||||||
beacon = navigator.sendBeacon(url, params.join('&'));
|
blob = new Blob([params.join('&')], headers);
|
||||||
} else {
|
} else {
|
||||||
beacon = navigator.sendBeacon(url, params);
|
blob = new Blob([JSON.stringify(params)], headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = {};
|
result = {};
|
||||||
if (beacon) {
|
if (navigator.sendBeacon(url, blob)) {
|
||||||
result.result = global_constants.SCORM_TRUE;
|
result.result = global_constants.SCORM_TRUE;
|
||||||
} else {
|
} else {
|
||||||
result.result = global_constants.SCORM_FALSE;
|
result.result = global_constants.SCORM_FALSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user