Files
chad/client/app/composables/use-updater.ts
opti1337 76f0ec74b5
Some checks failed
Deploy / deploy (push) Has been cancelled
Deploy / publish-web (push) Successful in 1m43s
Deploy / publish-tauri (push) Has been cancelled
test publish
2025-12-22 19:23:06 +06:00

28 lines
558 B
TypeScript

import type { Update } from '@tauri-apps/plugin-updater'
import { check } from '@tauri-apps/plugin-updater'
import { createGlobalState } from '@vueuse/core'
export const useUpdater = createGlobalState(() => {
const lastUpdate = shallowRef<Update>()
const checking = ref(false)
async function checkForUpdates() {
try {
checking.value = true
lastUpdate.value = (await check()) ?? undefined
}
finally {
checking.value = false
}
return lastUpdate.value
}
return {
lastUpdate,
checkForUpdates,
}
})