fix ie11 account deletion

This commit is contained in:
jaebradley
2018-05-10 10:28:44 -04:00
parent a84884fff9
commit eba6b8cff0
4 changed files with 5 additions and 12 deletions

View File

@@ -1,4 +1,3 @@
import 'url-search-params-polyfill';
import 'whatwg-fetch';
import Cookies from 'js-cookie';
@@ -6,10 +5,11 @@ const deactivate = (password) => fetch('/api/user/v1/accounts/deactivate_logout/
method: 'POST',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-CSRFToken': Cookies.get('csrftoken'),
},
body: new URLSearchParams({ password }),
// URLSearchParams + polyfill doesn't work in IE11
body: `password=${encodeURIComponent(password)}`,
}).then((response) => {
if (response.ok) {
return response;

View File

@@ -1,7 +1,6 @@
/* globals gettext */
/* eslint-disable react/no-danger */
import React from 'react';
import 'whatwg-fetch';
import PropTypes from 'prop-types';
import { Button, Modal, Icon, InputText, StatusAlert } from '@edx/paragon/static';
import StringUtils from 'edx-ui-toolkit/js/utils/string-utils';
@@ -46,8 +45,8 @@ class StudentAccountDeletionConfirmationModal extends React.Component {
validationErrorDetails: '',
}))
.catch(error => this.failedSubmission(error))
),
);
),
);
}
failedSubmission(error) {

5
package-lock.json generated
View File

@@ -10391,11 +10391,6 @@
}
}
},
"url-search-params-polyfill": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/url-search-params-polyfill/-/url-search-params-polyfill-3.0.0.tgz",
"integrity": "sha512-oRNWuBkJ/zKKK1aiBaTBZTf07zOKd0g+nJYB+vFNPO14gFjA75BaHgIJLtveWBRxI/2qff7xcTb9H6wkpTmqjg=="
},
"user-home": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz",

View File

@@ -55,7 +55,6 @@
"uglify-js": "2.7.0",
"underscore": "1.8.3",
"underscore.string": "3.3.4",
"url-search-params-polyfill": "3.0.0",
"webpack": "2.7.0",
"webpack-bundle-tracker": "0.2.1",
"webpack-merge": "4.1.1",