This commit is contained in:
torgaw 2024-11-01 13:47:57 +03:00
parent e3f2e33b90
commit 1c3685199b
22 changed files with 28 additions and 29 deletions

View File

@ -1,7 +1,7 @@
<script>
import { SvelteToast } from "@zerodevx/svelte-toast";
import { onMount } from "svelte";
import "../app.css";
import "../../app.css";
import Navbar from "$lib/ui-components/navbar.svelte";
import { checkAuth, checkAuthSync } from "$lib/auth/Auth";
import { redirect } from "$lib/tools/url/URLTools";
@ -10,32 +10,31 @@
let loggedIn = false;
let authCheckInProgress = false;
AuthStorage.subscribe((s)=>{
AuthStorage.subscribe((s) => {
loggedIn = s.logged;
});
onMount(() => {
if (!checkAuthSync() && !window.location.pathname.toLocaleLowerCase().includes("/login")) {
if (
!checkAuthSync() &&
!window.location.pathname.toLocaleLowerCase().includes("/login")
) {
redirect("/admin/login");
}
else if (checkAuthSync())
{
} else if (checkAuthSync()) {
loggedIn = true;
}
});
</script>
{#if loggedIn}
<div class="fixed left-0 right-0 top-0 flex z-10">
<div class="fixed left-0 right-0 top-0 flex z-10">
<Navbar />
</div>
</div>
{/if}
<div class="flex justify-center flex-shrink-0 w-full h-[calc(100vh-52px-68px)] mt-[68px] overflow-auto p-4">
<div
class="flex justify-center flex-shrink-0 w-full h-[calc(100vh-52px-68px)] mt-[68px] overflow-auto p-4"
>
<div class="flex w-full md:max-w-[90%] lg:max-w-[1080px]">
<slot />
</div>

View File

@ -20,21 +20,21 @@ const config = {
prerender: {
// default: true,
entries: [
"/user/change/sampleToken",
"/user/edit/req/sampleToken/sampleReqID",
"/user/neworder/sampleToken",
"/user/profile/sampleToken",
"/",
"/login",
"/newuser",
"/userslist",
"/disputes",
"/payouts",
"/merchants",
"/orders",
"/currencies",
"/sms",
"/withdrawals"
"/admin/user/change/sampleToken",
"/admin/user/edit/req/sampleToken/sampleReqID",
"/admin/user/neworder/sampleToken",
"/admin/user/profile/sampleToken",
"/admin/",
"/admin/login",
"/admin/newuser",
"/admin/userslist",
"/admin/disputes",
"/admin/payouts",
"/admin/merchants",
"/admin/orders",
"/admin/currencies",
"/admin/sms",
"/admin/withdrawals"
],
},
},