Store 초기화를 hooks.client.ts에서 수행하도록 변경

This commit is contained in:
static
2025-01-04 00:00:55 +09:00
parent aad5617d25
commit da18e6856a
5 changed files with 47 additions and 49 deletions

View File

@@ -1,4 +1,5 @@
<script lang="ts">
import { onMount } from "svelte";
import { goto } from "$app/navigation";
import { TitleDiv } from "$lib/components/divs";
import { clientKeyStore, masterKeyStore } from "$lib/stores";
@@ -14,17 +15,13 @@
: undefined,
);
$effect(() => {
if ($masterKeyStore) {
goto(data.redirectPath);
} else if ($clientKeyStore) {
requestMasterKeyDownload($clientKeyStore.decryptKey, $clientKeyStore.verifyKey).then(
async (ok) => {
if (ok) {
return await goto(data.redirectPath);
}
},
);
onMount(async () => {
if (
$masterKeyStore ||
($clientKeyStore &&
(await requestMasterKeyDownload($clientKeyStore.decryptKey, $clientKeyStore.verifyKey)))
) {
await goto(data.redirectPath);
}
});
</script>