Fix translation key removal

01b83f893bcfb474ef9f01d36a68c3289603645b

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +14 -3Ignore whitespace
public/scripts/extensions/translate/index.js+14 -3
@@ -598,9 +598,20 @@ jQuery(async () => {
598 $(document).on('click', '.mes_translate', onMessageTranslateClick);598 $(document).on('click', '.mes_translate', onMessageTranslateClick);
599 $('#translate_key_button').on('click', async () => {599 $('#translate_key_button').on('click', async () => {
600 const optionText = $('#translation_provider option:selected').text();600 const optionText = $('#translation_provider option:selected').text();
601 const key = await callGenericPopup(`<h3>${optionText} API Key</h3>`, POPUP_TYPE.INPUT);601 const key = await callGenericPopup(`<h3>${optionText} API Key</h3>`, POPUP_TYPE.INPUT, '', {
602 customButtons: [{
603 text: 'Remove Key',
604 appendAtEnd: true,
605 result: POPUP_RESULT.NEGATIVE,
606 action: async () => {
607 await writeSecret(extension_settings.translate.provider, '');
608 toastr.success('API Key removed');
609 $('#translate_key_button').toggleClass('success', !!secret_state[extension_settings.translate.provider]);
610 },
611 }],
612 });
602613
603 if (key == false) {614 if (!key) {
604 return;615 return;
605 }616 }
606617
@@ -634,7 +645,7 @@ jQuery(async () => {
634 }],645 }],
635 });646 });
636647
637 if (url == false || url == '') {648 if (!url) {
638 return;649 return;
639 }650 }
640651