mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 07:27:33 +08:00
34 lines
996 B
TypeScript
34 lines
996 B
TypeScript
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
|
|
};
|
|
}
|