fixes serverside pb auth
This commit is contained in:
@@ -1,12 +1,21 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<script>
|
||||||
|
localStorage.theme === 'dark' ||
|
||||||
|
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
|
||||||
|
? document.documentElement.classList.add('dark')
|
||||||
|
: document.documentElement.classList.add('light');
|
||||||
|
</script>
|
||||||
%sveltekit.head%
|
%sveltekit.head%
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body data-sveltekit-preload-data="hover">
|
<body data-sveltekit-preload-data="hover">
|
||||||
<div style="display: contents">%sveltekit.body%</div>
|
<div style="display: contents">%sveltekit.body%</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
--content: 0, 0, 0;
|
--content: 0, 0, 0;
|
||||||
|
|
||||||
--input-background: 249, 250, 251;
|
--input-background: 249, 250, 251;
|
||||||
|
--input-background-error: 254, 242, 242;
|
||||||
--input-border: 209, 213, 219;
|
--input-border: 209, 213, 219;
|
||||||
--input-border-focus: 36, 39, 52;
|
--input-border-focus: 36, 39, 52;
|
||||||
--input-ring: 148, 163, 184;
|
--input-ring: 148, 163, 184;
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
--content: 255, 255, 255;
|
--content: 255, 255, 255;
|
||||||
|
|
||||||
--input-background: 36, 39, 52;
|
--input-background: 36, 39, 52;
|
||||||
|
--input-background-error: 69, 10, 10;
|
||||||
--input-border: 43, 46, 61;
|
--input-border: 43, 46, 61;
|
||||||
--input-border-focus: 108, 115, 150;
|
--input-border-focus: 108, 115, 150;
|
||||||
--input-ring: 108, 115, 150;
|
--input-ring: 108, 115, 150;
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { createInstance } from '$lib/pocketbase'
|
import { createInstance, pb } from '$lib/pocketbase'
|
||||||
import type { Handle } from '@sveltejs/kit'
|
import type { Handle } from '@sveltejs/kit'
|
||||||
|
|
||||||
export const handle: Handle = async ({ event, resolve }) => {
|
export const handle: Handle = async ({ event, resolve }) => {
|
||||||
const pb = createInstance()
|
|
||||||
|
|
||||||
// load the store data from the request cookie string
|
// load the store data from the request cookie string
|
||||||
pb.authStore.loadFromCookie(event.request.headers.get('cookie') || '')
|
pb.authStore.loadFromCookie(event.request.headers.get('cookie') || '')
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class={extraClasses}
|
class="{extraClasses} flex items-center justify-center"
|
||||||
class:btn-primary={primary}
|
class:btn-primary={primary}
|
||||||
class:btn-secondary={secondary}
|
class:btn-secondary={secondary}
|
||||||
class:btn-large={large}
|
class:btn-large={large}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
{name}
|
{name}
|
||||||
class="bg-input-background border border-input-border rounded-md p-3 transition-colors focus:border-input-border-focus focus:outline-none focus:ring-0 w-full {extraClasses}"
|
class="bg-input-background border border-input-border rounded-md p-3 transition-colors focus:border-input-border-focus focus:outline-none focus:ring-0 w-full {extraClasses}"
|
||||||
class:border-red-400={error.length > 0}
|
class:border-red-400={error.length > 0}
|
||||||
class:bg-red-50={error.length > 0}
|
class:bg-input-background-error={error.length > 0}
|
||||||
{autocomplete}
|
{autocomplete}
|
||||||
use:typeAction
|
use:typeAction
|
||||||
bind:value
|
bind:value
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ type Theme = "dark" | "light"
|
|||||||
export const theme: Writable<Theme> = writable(browser && localStorage.getItem("theme") as Theme || "light" );
|
export const theme: Writable<Theme> = writable(browser && localStorage.getItem("theme") as Theme || "light" );
|
||||||
|
|
||||||
export function toggleTheme() {
|
export function toggleTheme() {
|
||||||
const newTheme = get(theme) === "light" ? "dark" : "light";
|
const currentTheme = get(theme);
|
||||||
|
const newTheme = currentTheme === "light" ? "dark" : "light";
|
||||||
|
document.documentElement.classList.remove(currentTheme)
|
||||||
|
document.documentElement.classList.add(newTheme)
|
||||||
theme.set(newTheme)
|
theme.set(newTheme)
|
||||||
localStorage.setItem("theme", newTheme);
|
localStorage.setItem("theme", newTheme);
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
import Toast from "$lib/components/base/toast.svelte";
|
import Toast from "$lib/components/base/toast.svelte";
|
||||||
import Footer from "$lib/components/footer.svelte";
|
import Footer from "$lib/components/footer.svelte";
|
||||||
import NavBar from "$lib/components/nav_bar.svelte";
|
import NavBar from "$lib/components/nav_bar.svelte";
|
||||||
import { theme } from "$lib/stores/theme_store";
|
|
||||||
import "@fortawesome/fontawesome-free/css/all.min.css";
|
import "@fortawesome/fontawesome-free/css/all.min.css";
|
||||||
import "../css/app.css";
|
import "../css/app.css";
|
||||||
import "../css/components.css";
|
import "../css/components.css";
|
||||||
@@ -12,10 +11,8 @@
|
|||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>| wanderer</title>
|
<title>| wanderer</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
<div class="theme {$theme}">
|
|
||||||
<NavBar></NavBar>
|
<NavBar></NavBar>
|
||||||
<Toast></Toast>
|
<Toast></Toast>
|
||||||
<slot />
|
<slot />
|
||||||
|
|
||||||
<Footer></Footer>
|
<Footer></Footer>
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
class="grid grid-cols-1 lg:grid-cols-2 justify-items-center gap-8 py-8"
|
class="grid grid-cols-1 lg:grid-cols-2 justify-items-center gap-8 py-8"
|
||||||
>
|
>
|
||||||
{#each $categories as category}
|
{#each $categories as category}
|
||||||
<a href="/trails?category={category.id}">
|
<a href="/trails?category={category.id}" data-sveltekit-preload-data="off">
|
||||||
<CategoryCard {category}></CategoryCard>
|
<CategoryCard {category}></CategoryCard>
|
||||||
</a>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Trail } from "$lib/models/trail";
|
import { Trail } from "$lib/models/trail";
|
||||||
import { categories_index } from "$lib/stores/category_store";
|
import { categories_index } from "$lib/stores/category_store";
|
||||||
import { trail, trails_show } from "$lib/stores/trail_store";
|
import { trails_show } from "$lib/stores/trail_store";
|
||||||
import { error, type Load } from "@sveltejs/kit";
|
import { error, type Load } from "@sveltejs/kit";
|
||||||
|
|
||||||
export const load: Load = async ({ params }) => {
|
export const load: Load = async ({ params }) => {
|
||||||
|
|||||||
@@ -274,7 +274,7 @@
|
|||||||
<button
|
<button
|
||||||
class="leaflet-control fa fa-{mapFullScreen
|
class="leaflet-control fa fa-{mapFullScreen
|
||||||
? 'minimize'
|
? 'minimize'
|
||||||
: 'maximize'} rounded-full text-lg bg-white px-[14px] py-2 hover:bg-gray-100"
|
: 'maximize'} rounded-full text-lg bg-white text-black px-[14px] py-2 hover:bg-gray-100"
|
||||||
style="cursor: pointer !important"
|
style="cursor: pointer !important"
|
||||||
on:click={() => toggleMapFullScreen()}
|
on:click={() => toggleMapFullScreen()}
|
||||||
></button>
|
></button>
|
||||||
|
|||||||
@@ -2,9 +2,5 @@ import { trails_show } from "$lib/stores/trail_store";
|
|||||||
import type { Load } from "@sveltejs/kit";
|
import type { Load } from "@sveltejs/kit";
|
||||||
|
|
||||||
export const load: Load = async ({ params }) => {
|
export const load: Load = async ({ params }) => {
|
||||||
try {
|
|
||||||
await trails_show(params.id!, true)
|
await trails_show(params.id!, true)
|
||||||
}catch(e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 781 KiB After Width: | Height: | Size: 284 KiB |
@@ -12,6 +12,7 @@ export default {
|
|||||||
'secondary-hover': 'rgba(var(--secondary-hover))',
|
'secondary-hover': 'rgba(var(--secondary-hover))',
|
||||||
|
|
||||||
'input-background': 'rgba(var(--input-background))',
|
'input-background': 'rgba(var(--input-background))',
|
||||||
|
'input-background-error': 'rgba(var(--input-background-error))',
|
||||||
'input-border': 'rgba(var(--input-border))',
|
'input-border': 'rgba(var(--input-border))',
|
||||||
'input-border-focus': 'rgba(var(--input-border-focus))',
|
'input-border-focus': 'rgba(var(--input-border-focus))',
|
||||||
'input-ring': 'rgba(var(--input-ring))',
|
'input-ring': 'rgba(var(--input-ring))',
|
||||||
|
|||||||
Reference in New Issue
Block a user