2021-10-11 17:24:46 +03:00
|
|
|
import Controller from '@ember/controller';
|
|
|
|
import {inject as service} from '@ember/service';
|
2021-10-12 17:19:27 +03:00
|
|
|
import {task} from 'ember-concurrency-decorators';
|
2021-10-11 17:24:46 +03:00
|
|
|
|
2021-10-12 17:19:27 +03:00
|
|
|
export default class SettingsDesignIndexController extends Controller {
|
2021-10-11 17:24:46 +03:00
|
|
|
@service config;
|
2021-10-12 17:19:27 +03:00
|
|
|
@service customThemeSettings;
|
|
|
|
@service notifications;
|
2021-10-11 17:24:46 +03:00
|
|
|
@service settings;
|
2021-10-12 17:19:27 +03:00
|
|
|
@service themeManagement;
|
|
|
|
|
|
|
|
@task
|
|
|
|
*saveTask() {
|
|
|
|
try {
|
|
|
|
if (this.settings.get('errors').length !== 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
yield Promise.all([
|
|
|
|
this.settings.save(),
|
|
|
|
this.customThemeSettings.save()
|
|
|
|
]);
|
|
|
|
|
|
|
|
// ensure task button switches to success state
|
|
|
|
return true;
|
|
|
|
} catch (error) {
|
|
|
|
if (error) {
|
|
|
|
this.notifications.showAPIError(error);
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-10-11 17:24:46 +03:00
|
|
|
}
|