Fix TTS falsy checks

This commit is contained in:
Cohee
2024-09-13 21:51:05 +03:00
parent 01b83f893b
commit 0ed39d19ec
2 changed files with 4 additions and 4 deletions

View File

@ -77,14 +77,14 @@ class AzureTtsProvider {
result: POPUP_RESULT.NEGATIVE, result: POPUP_RESULT.NEGATIVE,
action: async () => { action: async () => {
await writeSecret(SECRET_KEYS.AZURE_TTS, ''); await writeSecret(SECRET_KEYS.AZURE_TTS, '');
$('#azure_tts_key').toggleClass('success', secret_state[SECRET_KEYS.AZURE_TTS]); $('#azure_tts_key').toggleClass('success', !!secret_state[SECRET_KEYS.AZURE_TTS]);
toastr.success('API Key removed'); toastr.success('API Key removed');
await this.onRefreshClick(); await this.onRefreshClick();
}, },
}], }],
}); });
if (key == false || key == '') { if (!key) {
return; return;
} }

View File

@ -86,14 +86,14 @@ class OpenAICompatibleTtsProvider {
result: POPUP_RESULT.NEGATIVE, result: POPUP_RESULT.NEGATIVE,
action: async () => { action: async () => {
await writeSecret(SECRET_KEYS.CUSTOM_OPENAI_TTS, ''); await writeSecret(SECRET_KEYS.CUSTOM_OPENAI_TTS, '');
$('#openai_compatible_tts_key').toggleClass('success', secret_state[SECRET_KEYS.CUSTOM_OPENAI_TTS]); $('#openai_compatible_tts_key').toggleClass('success', !!secret_state[SECRET_KEYS.CUSTOM_OPENAI_TTS]);
toastr.success('API Key removed'); toastr.success('API Key removed');
await this.onRefreshClick(); await this.onRefreshClick();
}, },
}], }],
}); });
if (key == false || key == '') { if (!key) {
return; return;
} }