diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 658f35d..41772eb 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -32,16 +32,11 @@ user = await whoami(); } else { user = null; - - if ($page.url.pathname !== '/') - goto('/login'); // Redirect to login if not authenticated } } catch (error) { console.error('Authentication check failed:', error); isAuthenticated = false; user = null; - if ($page.url.pathname !== '/') - goto('/login'); // Redirect to login if not authenticated } }); diff --git a/src/lib/components/PointEditor.svelte b/src/lib/components/PointEditor.svelte index a5d17a4..02cfb5b 100644 --- a/src/lib/components/PointEditor.svelte +++ b/src/lib/components/PointEditor.svelte @@ -1,197 +1,8 @@ - - - - - - - { - isConfirmationVisible = false; - handleDeletePoint(selectedPoint); - }} - oncancel={() => { - isConfirmationVisible = false; - }} -> -

Вы уверены, что хотите удалить эту точку?

-
\ No newline at end of file + \ No newline at end of file diff --git a/src/lib/components/PointListModal.svelte b/src/lib/components/PointListModal.svelte index b47abc9..51e0e34 100644 --- a/src/lib/components/PointListModal.svelte +++ b/src/lib/components/PointListModal.svelte @@ -16,24 +16,16 @@ import { addToast } from "$lib/components/Toast.svelte"; import type { SavedPoint } from "$lib/types"; import { SavedPointsStore } from "$lib/stores"; - import ConfirmationPrompt from "./ConfirmationPrompt.svelte"; import { getSavedPoints, savePoint, updatePoint, deletePoint } from "$lib/api/points"; // Props - let { - isOpen = $bindable(false), - onClose = () => {}, - onChange = () => {}, - point = null, - coordinates = { id: 0, name: "", lat: 0, lon: 0, alt: 0 }, - } = $props(); + let { isOpen = $bindable(false), onClose = () => {}, onChange = () => {} } = $props(); // Runes - let selectedPoint = $state(point); - let newPoint = $state(coordinates as SavedPoint); + let selectedPoint = $state(null); + let newPoint = $state({ id: 0, name: "", lat: 0, lon: 0, alt: 0 }); let isEditing = $state(false); let isAlertVisible = $state(false); - let isConfirmationVisible = $state(false); let alertText = $state(""); // Table handler @@ -67,13 +59,7 @@ isEditing = true; } - function confirmDeletePoint(point: SavedPoint) { - selectedPoint = point; - isConfirmationVisible = true; - } - - function handleDeletePoint(point: SavedPoint | null) { - if (!point) return; + function handleDeletePoint(point: SavedPoint) { deletePoint(point.id) .then(() => { $SavedPointsStore = $SavedPointsStore.filter((p) => p.id !== point.id); @@ -143,7 +129,7 @@ } - + - - { - isConfirmationVisible = false; - handleDeletePoint(selectedPoint); - }} - oncancel={() => { - isConfirmationVisible = false; - }} -> -

Вы уверены, что хотите удалить эту точку?

-
\ No newline at end of file diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index d027858..a48518c 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -86,7 +86,7 @@ Войти {/if} - Назад + Назад diff --git a/src/routes/user/account/+page.svelte b/src/routes/user/account/+page.svelte index 7b1f76f..7f58e31 100644 --- a/src/routes/user/account/+page.svelte +++ b/src/routes/user/account/+page.svelte @@ -116,7 +116,7 @@
-
+