migrate app lock settings page to composition API and typescript

This commit is contained in:
MaysWind
2025-01-16 22:37:35 +08:00
parent adebc96637
commit 4f21762533
7 changed files with 310 additions and 301 deletions
@@ -0,0 +1,33 @@
import { ref, computed } from 'vue';
import { useSettingsStore } from '@/stores/setting.ts';
import { isWebAuthnCompletelySupported } from '@/lib/webauthn.ts';
export function useAppLockPageBase() {
const settingsStore = useSettingsStore();
const isSupportedWebAuthn = ref<boolean>(false);
const isEnableApplicationLock = computed<boolean>({
get: () => settingsStore.appSettings.applicationLock,
set: (value) => settingsStore.setEnableApplicationLock(value)
});
const isEnableApplicationLockWebAuthn = computed<boolean>({
get: () => settingsStore.appSettings.applicationLockWebAuthn,
set: (value) => settingsStore.setEnableApplicationLockWebAuthn(value)
});
isWebAuthnCompletelySupported().then(result => {
isSupportedWebAuthn.value = result;
});
return {
// states
isSupportedWebAuthn,
// computed states
isEnableApplicationLock,
isEnableApplicationLockWebAuthn
};
}