@@ -72,21 +72,24 @@ const ImportSettings = ( {
7272 setNotice ( __ ( 'Failed to import settings.' , i18n ) )
7373 // eslint-disable-next-line no-console
7474 console . error ( sprintf ( __ ( 'Stackable: Import error - %s' , i18n ) , Object . values ( errors ) . join ( '\n' ) ) )
75- } else if ( Object . keys ( settingsToSave ) . length === 0 ) {
75+ return
76+ }
77+
78+ if ( Object . keys ( settingsToSave ) . length === 0 ) {
7679 setNotice ( __ ( 'No settings imported.' , i18n ) )
77- } else {
78- const model = new models . Settings ( settingsToSave )
79- try {
80- await model . save ( )
81- setNotice ( __ ( 'Settings imported successfully.' , i18n ) )
82- } catch ( e ) {
83- setNotice ( __ ( 'Failed to import settings.' , i18n ) )
84- // eslint-disable-next-line no-console
85- console . error ( sprintf ( __ ( 'Stackable: Import error - %s' , i18n ) , e ) )
86- }
87- }
80+ return
81+ }
8882
89- onClose ( )
83+ const model = new models . Settings ( settingsToSave )
84+ try {
85+ await model . save ( )
86+ setNotice ( __ ( 'Settings imported successfully.' , i18n ) )
87+ onClose ( )
88+ } catch ( e ) {
89+ setNotice ( __ ( 'Failed to import settings.' , i18n ) )
90+ // eslint-disable-next-line no-console
91+ console . error ( sprintf ( __ ( 'Stackable: Import error - %s' , i18n ) , e ) )
92+ }
9093 }
9194
9295 const AllImportSettings = useMemo ( ( ) => applyFilters ( 'stackable.admin-settings.import-settings' , Fragment ) , [ ] )
0 commit comments