diff --git a/src/routes/cv/+page.svelte b/src/routes/cv/+page.svelte index 44a0253..1c13f84 100644 --- a/src/routes/cv/+page.svelte +++ b/src/routes/cv/+page.svelte @@ -50,21 +50,27 @@ const params = new URLSearchParams(window.location.search); debug = params.has("debug"); + + loadMotivation(); }); - let moticationInput: HTMLInputElement; + let motivationInput: HTMLTextAreaElement; + let motivation: string | null = ""; function loadMotivation() { - const motivation = localStorage.getItem("motivation"); - if (!motivation) return; - - moticationInput.value = motivation; + const content = localStorage.getItem("motivation"); + if (content && motivationInput) { + motivationInput.value = content; + motivation = content; + } } + function submitMotivation() { - console.log(moticationInput.value); - if (!moticationInput.value) { + if (!motivationInput) return; + const content = motivationInput.value; + if (!content.trim()) { localStorage.removeItem("motivation"); } else { - localStorage.setItem("motivation", moticationInput.value); + localStorage.setItem("motivation", content); } window.location.reload(); } @@ -81,7 +87,8 @@