immich/web/src/lib/components/user-settings-page/PinCodeSettings.svelte

34 lines
896 B
Svelte
Raw Normal View History

<script lang="ts">
2026-01-09 13:03:57 -05:00
import OnEvents from '$lib/components/OnEvents.svelte';
import PinCodeChangeForm from '$lib/components/user-settings-page/PinCodeChangeForm.svelte';
import PinCodeCreateForm from '$lib/components/user-settings-page/PinCodeCreateForm.svelte';
import { getAuthStatus } from '@immich/sdk';
import { onMount } from 'svelte';
import { fade } from 'svelte/transition';
let hasPinCode = $state(false);
onMount(async () => {
const { pinCode } = await getAuthStatus();
hasPinCode = pinCode;
});
2025-08-07 15:07:31 -04:00
2026-01-09 13:03:57 -05:00
const onUserPinCodeReset = () => {
hasPinCode = false;
2025-08-07 15:07:31 -04:00
};
</script>
2026-01-09 13:03:57 -05:00
<OnEvents {onUserPinCodeReset} />
2025-08-07 15:07:31 -04:00
<section>
{#if hasPinCode}
2025-08-07 15:07:31 -04:00
<div in:fade={{ duration: 200 }}>
2026-01-09 13:03:57 -05:00
<PinCodeChangeForm />
</div>
{:else}
2025-08-07 15:07:31 -04:00
<div in:fade={{ duration: 200 }}>
<PinCodeCreateForm onCreated={() => (hasPinCode = true)} />
</div>
{/if}
</section>