setting.js 777 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict';
  2. const BaseController = require('../base');
  3. class SettingController extends BaseController {
  4. async autoLaunchEnable() {
  5. const { service } = this;
  6. await service.setting.autoLaunchEnable();
  7. const data = {
  8. isEnabled: true
  9. };
  10. this.sendSuccess(data);
  11. }
  12. async autoLaunchDisable() {
  13. const { service } = this;
  14. await service.setting.autoLaunchDisable();
  15. const data = {
  16. isEnabled: false
  17. };
  18. this.sendSuccess(data);
  19. }
  20. async autoLaunchIsEnabled() {
  21. const { service } = this;
  22. const data = {
  23. isEnabled: null
  24. };
  25. const isEnabled = await service.setting.autoLaunchIsEnabled();
  26. data.isEnabled = isEnabled;
  27. this.sendSuccess(data);
  28. }
  29. }
  30. module.exports = SettingController;