From eba6b8cff0f570a92a2e2ba82cfc9bedc0e4886a Mon Sep 17 00:00:00 2001 From: jaebradley <jae.b.bradley@gmail.com> Date: Thu, 10 May 2018 10:28:44 -0400 Subject: [PATCH] fix ie11 account deletion --- lms/static/js/student_account/AccountsClient.js | 6 +++--- .../components/StudentAccountDeletionModal.jsx | 5 ++--- package-lock.json | 5 ----- package.json | 1 - 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/lms/static/js/student_account/AccountsClient.js b/lms/static/js/student_account/AccountsClient.js index f4c896f16f0..4f5e933ee07 100644 --- a/lms/static/js/student_account/AccountsClient.js +++ b/lms/static/js/student_account/AccountsClient.js @@ -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; diff --git a/lms/static/js/student_account/components/StudentAccountDeletionModal.jsx b/lms/static/js/student_account/components/StudentAccountDeletionModal.jsx index 2ffbb41aaa8..8fadf5e1843 100644 --- a/lms/static/js/student_account/components/StudentAccountDeletionModal.jsx +++ b/lms/static/js/student_account/components/StudentAccountDeletionModal.jsx @@ -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) { diff --git a/package-lock.json b/package-lock.json index 9e1bd53f224..8ebfecde8f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index a1882c188d4..d13c789276d 100644 --- a/package.json +++ b/package.json @@ -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", -- GitLab