refactor: Add reloadSystem function to saveDirectories, saveNotificationSetting, saveDownloaderSetting, and saveMediaServerSetting

This commit is contained in:
jxxghp
2024-09-09 09:52:49 +08:00
parent df057ebe4d
commit b28347d191
3 changed files with 49 additions and 5 deletions
+15 -2
View File
@@ -20,6 +20,17 @@ const mediaCategories = ref<{ [key: string]: any }>({})
// 提示框
const $toast = useToast()
// 重载系统生效配置
async function reloadSystem() {
try {
const result: { [key: string]: any } = await api.get('system/reload')
if (result.success) $toast.success('系统配置已生效')
else $toast.error('重载系统失败!')
} catch (error) {
console.log(error)
}
}
// 移动结束
function orderDirectoryCards() {
// 更新所有目录的优先级
@@ -65,8 +76,10 @@ async function saveDirectories() {
orderDirectoryCards()
try {
const result: { [key: string]: any } = await api.post('system/setting/Directories', directories.value)
if (result.success) $toast.success('目录设置保存成功')
else $toast.error('目录设置保存失败!')
if (result.success) {
$toast.success('目录设置保存成功')
await reloadSystem()
} else $toast.error('目录设置保存失败!')
} catch (error) {
console.log(error)
}