|
|
@ -189,6 +189,8 @@ export default {
|
|
|
|
* @param {string} [currentPassword] Only need for disableAuth to true
|
|
|
|
* @param {string} [currentPassword] Only need for disableAuth to true
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
saveSettings(callback, currentPassword) {
|
|
|
|
saveSettings(callback, currentPassword) {
|
|
|
|
|
|
|
|
let valid = this.validateSettings();
|
|
|
|
|
|
|
|
if (valid.success) {
|
|
|
|
this.$root.getSocket().emit("setSettings", this.settings, currentPassword, (res) => {
|
|
|
|
this.$root.getSocket().emit("setSettings", this.settings, currentPassword, (res) => {
|
|
|
|
this.$root.toastRes(res);
|
|
|
|
this.$root.toastRes(res);
|
|
|
|
this.loadSettings();
|
|
|
|
this.loadSettings();
|
|
|
@ -197,6 +199,26 @@ export default {
|
|
|
|
callback();
|
|
|
|
callback();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.$root.toastError(valid.msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Ensure settings are valid
|
|
|
|
|
|
|
|
* @returns {Object} Contains success state and error msg
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
validateSettings() {
|
|
|
|
|
|
|
|
if (this.settings.keepDataPeriodDays < 0) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
success: false,
|
|
|
|
|
|
|
|
msg: this.$t("dataRetentionTimeError"),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
success: true,
|
|
|
|
|
|
|
|
msg: "",
|
|
|
|
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|