Fix/UI detail (#414)

This commit is contained in:
m1m1sha
2024-10-12 00:36:57 +08:00
committed by GitHub
parent d2291628e0
commit 9824d0adaa
10 changed files with 664 additions and 685 deletions
+10 -1
View File
@@ -2,7 +2,16 @@ import { disable, enable, isEnabled } from '@tauri-apps/plugin-autostart'
export async function loadAutoLaunchStatusAsync(target_enable: boolean): Promise<boolean> {
try {
target_enable ? await enable() : await disable()
if (target_enable) {
await enable()
}
else {
// 消除没有配置自启动时进行关闭操作报错
try {
await disable()
}
catch { }
}
localStorage.setItem('auto_launch', JSON.stringify(await isEnabled()))
return isEnabled()
}