From 0f68d3e6507bd579237fa004cc98c3adc527804f Mon Sep 17 00:00:00 2001 From: relaxed <> Date: Wed, 25 Dec 2024 13:32:44 +0500 Subject: [PATCH] add is login requied --- src/lib/components/ui/ScreenWrap.svelte | 22 ++++++++++++++-------- src/routes/+page.svelte | 3 ++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/lib/components/ui/ScreenWrap.svelte b/src/lib/components/ui/ScreenWrap.svelte index b2324b4..a4afa1d 100644 --- a/src/lib/components/ui/ScreenWrap.svelte +++ b/src/lib/components/ui/ScreenWrap.svelte @@ -114,8 +114,7 @@ WHERE id = ${current_item.id}`; export let is_dialog_item_add = false; let is_logedin = false; - - export let data_access; + export let is_login_requied = true; let access_level = ""; /** @@ -135,6 +134,11 @@ WHERE id = ${current_item.id}`; onMount(async () => { await load_db(); is_loaded = true; + if (!is_login_requied) { + is_logedin = true; + check_access = () => true; + check_login = async () => [true, ""]; + } }); $: cur_dialog_name = is_dialog_item_add ? `Добавить в ${db_scheme[current_page].tables[current_table]}` @@ -149,12 +153,14 @@ WHERE id = ${current_item.id}`; bind:is_view_open check_access={(name) => check_access(access_level, name, null)} on_logout={() => { - is_logedin = false; - // @ts-ignore - access_level = ""; - current_page = "Запросы"; - current_table = ""; - current_view = ""; + if (is_login_requied) { + is_logedin = false; + // @ts-ignore + access_level = ""; + current_page = "Запросы"; + current_table = ""; + current_view = ""; + } }} > diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index c78260e..5df44d3 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -170,6 +170,7 @@ CREATE TABLE IF NOT EXISTS IdBuffer (id INTEGER); let is_item_dialog_open = false; let is_dialog_item_add = false; + let is_login_requied = false; /** * @param {string} access_level @@ -216,10 +217,10 @@ insert into IdBuffer (id) values (${ar.join("), (")});`);