mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-06-01 05:40:41 +08:00
移除多个组件中的重载系统生效配置函数,简化保存设置逻辑
This commit is contained in:
@@ -59,19 +59,6 @@ async function loadSystemSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
// 重载系统生效配置
|
||||
async function reloadSystem() {
|
||||
progressDialog.value = true
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.get('system/reload')
|
||||
if (result.success) $toast.success(t('setting.system.reloadSuccess'))
|
||||
else $toast.error(t('setting.system.reloadFailed'))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
progressDialog.value = false
|
||||
}
|
||||
|
||||
// 移动结束
|
||||
function orderDirectoryCards() {
|
||||
// 更新所有目录的优先级
|
||||
@@ -124,7 +111,6 @@ async function saveDirectories() {
|
||||
const result: { [key: string]: any } = await api.post('system/setting/Directories', directories.value)
|
||||
if (result.success) {
|
||||
$toast.success(t('setting.directory.directorySaveSuccess'))
|
||||
await reloadSystem()
|
||||
} else $toast.error(t('setting.directory.directorySaveFailed'))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
|
||||
@@ -103,19 +103,6 @@ const notificationTime = ref({
|
||||
end: '23:59',
|
||||
})
|
||||
|
||||
// 重载系统生效配置
|
||||
async function reloadSystem() {
|
||||
progressDialog.value = true
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.get('system/reload')
|
||||
if (result.success) $toast.success(t('setting.system.reloadSuccess'))
|
||||
else $toast.error(t('setting.system.reloadFailed'))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
progressDialog.value = false
|
||||
}
|
||||
|
||||
// 添加通知渠道
|
||||
function addNotification(notification: string) {
|
||||
let name = `${t('setting.notification.channel')}${notifications.value.length + 1}`
|
||||
@@ -199,7 +186,6 @@ async function saveNotificationSetting() {
|
||||
const result: { [key: string]: any } = await api.post('system/setting/Notifications', notifications.value)
|
||||
if (result.success) {
|
||||
$toast.success(t('setting.notification.saveSuccess'))
|
||||
await reloadSystem()
|
||||
} else $toast.error(t('setting.notification.saveFailed'))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
@@ -212,7 +198,6 @@ async function saveNotificationTime() {
|
||||
const result: { [key: string]: any } = await api.post('system/setting/NotificationSendTime', notificationTime.value)
|
||||
if (result.success) {
|
||||
$toast.success(t('setting.notification.timeSaveSuccess'))
|
||||
await reloadSystem()
|
||||
} else $toast.error(t('setting.notification.timeSaveFailed'))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
|
||||
@@ -96,27 +96,12 @@ async function loadSiteSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
// 重载系统生效配置
|
||||
async function reloadSystem() {
|
||||
progressDialog.value = true
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.get('system/reload')
|
||||
if (result.success) $toast.success(t('setting.system.reloadSuccess'))
|
||||
else $toast.error(t('setting.system.reloadFailed'))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
progressDialog.value = false
|
||||
}
|
||||
|
||||
// 调用API保存设置
|
||||
async function saveSiteSetting(value: { [key: string]: any }) {
|
||||
console.log(`正在保存设置:${JSON.stringify(value)}`)
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.post('system/env', value)
|
||||
if (result.success) {
|
||||
$toast.success(t('setting.site.saveSuccess'))
|
||||
await reloadSystem()
|
||||
} else {
|
||||
$toast.error(t('setting.site.saveFailed'))
|
||||
}
|
||||
|
||||
@@ -153,19 +153,6 @@ async function querySubscribeRules() {
|
||||
}
|
||||
}
|
||||
|
||||
// 重载系统生效配置
|
||||
async function reloadSystem() {
|
||||
progressDialog.value = true
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.get('system/reload')
|
||||
if (result.success) $toast.success(t('setting.system.reloadSuccess'))
|
||||
else $toast.error(t('setting.system.reloadFailed'))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
progressDialog.value = false
|
||||
}
|
||||
|
||||
// 保存订阅设置
|
||||
async function saveSubscribeSetting() {
|
||||
try {
|
||||
@@ -183,7 +170,6 @@ async function saveSubscribeSetting() {
|
||||
|
||||
if (result1.success && result2.success && result3) {
|
||||
$toast.success(t('setting.subscribe.settingsSaveSuccess'))
|
||||
await reloadSystem()
|
||||
} else $toast.error(t('setting.subscribe.settingsSaveFailed'))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
|
||||
@@ -131,19 +131,6 @@ async function loadDownloaderSetting() {
|
||||
}
|
||||
}
|
||||
|
||||
// 重载系统生效配置
|
||||
async function reloadSystem() {
|
||||
progressDialog.value = true
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.get('system/reload')
|
||||
if (result.success) $toast.success(t('setting.system.reloadSuccess'))
|
||||
else $toast.error(t('setting.system.reloadFailed'))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
progressDialog.value = false
|
||||
}
|
||||
|
||||
// 调用API保存下载器设置
|
||||
async function saveDownloaderSetting() {
|
||||
try {
|
||||
@@ -158,7 +145,6 @@ async function saveDownloaderSetting() {
|
||||
else $toast.error(t('setting.system.downloaderSaveFailed'))
|
||||
|
||||
await loadDownloaderSetting()
|
||||
await reloadSystem()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user