1- import { ref } from 'vue'
2- import { invoke } from '@tauri-apps/api/core'
3- import { listen } from '@tauri-apps/api/event'
4- import { CheckCircle , Download , RefreshCw , Wifi } from 'lucide-vue-next'
1+ import { ref } from 'vue'
2+ import { invoke } from '@tauri-apps/api/core'
3+ import { listen } from '@tauri-apps/api/event'
4+ import { CheckCircle , Download , RefreshCw , Wifi } from 'lucide-vue-next'
55
66interface UpdateInfo
77{
@@ -164,16 +164,19 @@ export function useUpdateManager()
164164 updateInfo . value = result
165165 hasUpdate . value = true
166166 currentStatus . value = 'UPDATE_AVAILABLE'
167+ return result
167168 }
168169 else {
169170 hasUpdate . value = false
170171 currentStatus . value = 'NO_UPDATE'
172+ return null
171173 }
172174 }
173175 catch ( error ) {
174176 console . error ( 'Failed to check for updates:' , error )
175177 errorMessage . value = String ( error )
176178 currentStatus . value = 'ERROR'
179+ return null
177180 }
178181 finally {
179182 isChecking . value = false
@@ -191,7 +194,7 @@ export function useUpdateManager()
191194 errorMessage . value = ''
192195
193196 try {
194- await invoke ( 'start_update' , { updateInfo : updateInfo . value } )
197+ await invoke ( 'start_update' , { updateInfo : updateInfo . value } )
195198 }
196199 catch ( error ) {
197200 console . error ( 'Failed to start update:' , error )
@@ -214,7 +217,7 @@ export function useUpdateManager()
214217 const setupUpdateListeners = async ( ) => {
215218 // 监听下载进度
216219 await listen ( 'update-progress' , ( event : any ) => {
217- const { progress, speed, status } = event . payload
220+ const { progress, speed, status} = event . payload
218221 downloadProgress . value = progress
219222 downloadSpeed . value = speed
220223
@@ -259,11 +262,11 @@ export function useUpdateManager()
259262 unitIndex ++
260263 }
261264
262- return `${ size . toFixed ( 1 ) } ${ units [ unitIndex ] } `
265+ return `${ size . toFixed ( 1 ) } ${ units [ unitIndex ] } `
263266 }
264267
265268 const formatSpeed = ( bytesPerSecond : number ) => {
266- return `${ formatSize ( bytesPerSecond ) } /s`
269+ return `${ formatSize ( bytesPerSecond ) } /s`
267270 }
268271
269272 return {
0 commit comments