UI: bugfix the need to double click on the import when importing an encrypted configuration

When back-end sends the schema for ui to validate that no unsafe options are selected, UI didn't automatically send a response back in case there were no unsafe options selected
This commit is contained in:
VakarisZ 2021-10-26 15:23:07 +03:00
parent 01f8488b07
commit 8e6a2d8e7d
1 changed files with 2 additions and 1 deletions

View File

@ -37,7 +37,7 @@ const ConfigImportModal = (props: Props) => {
if (configContents !== null) { if (configContents !== null) {
sendConfigToServer(); sendConfigToServer();
} }
}, [configContents]) }, [configContents, unsafeOptionsVerified])
function sendConfigToServer() { function sendConfigToServer() {
@ -67,6 +67,7 @@ const ConfigImportModal = (props: Props) => {
} else if (res['import_status'] === 'unsafe_options_verification_required') { } else if (res['import_status'] === 'unsafe_options_verification_required') {
setUploadStatus(UploadStatuses.success); setUploadStatus(UploadStatuses.success);
setErrorMessage(''); setErrorMessage('');
if (isUnsafeOptionSelected(res['config_schema'], JSON.parse(res['config']))) { if (isUnsafeOptionSelected(res['config_schema'], JSON.parse(res['config']))) {
setShowUnsafeOptionsConfirmation(true); setShowUnsafeOptionsConfirmation(true);
setCandidateConfig(res['config']); setCandidateConfig(res['config']);