upgrade: Avoid duplicate errors accumulating.

This commit is contained in:
Tim Abbott 2023-11-21 09:05:45 -08:00
parent 2b68b300a1
commit e4d3d4b31d
1 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,11 @@ export const initialize = (): void => {
$("#org-upgrade-button").on("click", (e) => {
e.preventDefault();
// Clear the error box in case this is a repeat request.
const $error_box = $("#autopay-error");
$error_box.text("");
$error_box.hide();
$("#org-upgrade-button-text").hide();
$("#org-upgrade-button .upgrade-button-loader").show();
helpers.create_ajax_request(
@ -45,7 +50,6 @@ export const initialize = (): void => {
() => {
$("#org-upgrade-button-text").show();
$("#org-upgrade-button .upgrade-button-loader").hide();
const $error_box = $("#autopay-error");
const error_text = $error_box.text();
$error_box.text(`${error_text} Please fix this issue or use a different card.`);
},