fixes trail sorting && secure cookie
This commit is contained in:
@@ -5,5 +5,5 @@ import { currentUser } from '$lib/stores/user_store';
|
||||
pb.authStore.loadFromCookie(document.cookie)
|
||||
pb.authStore.onChange(() => {
|
||||
currentUser.set(pb.authStore.model as User)
|
||||
document.cookie = pb.authStore.exportToCookie({ httpOnly: false })
|
||||
document.cookie = pb.authStore.exportToCookie({ httpOnly: false, secure: location.protocol === "https:" })
|
||||
}, true)
|
||||
@@ -65,7 +65,7 @@ export const handle: Handle = async ({ event, resolve }) => {
|
||||
// send back the default 'pb_auth' cookie to the client with the latest store state
|
||||
response.headers.set(
|
||||
'set-cookie',
|
||||
pb.authStore.exportToCookie({ httpOnly: false, secure: true })
|
||||
pb.authStore.exportToCookie({ httpOnly: false, secure: event.url.protocol === "https:" })
|
||||
)
|
||||
|
||||
return response
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="trail-filter p-8 border border-input-border rounded-xl">
|
||||
<div class="trail-filter sticky top-4 p-8 border border-input-border rounded-xl self-start">
|
||||
{#if showTrailSearch}
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="basis-full">
|
||||
|
||||
@@ -38,7 +38,7 @@ export async function trails_search_filter(filter: TrailFilter, page: number = 1
|
||||
|
||||
let r = await f("/api/v1/search/trails", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ q: filter.q, options: { filter: filterText, hitsPerPage: 21, page: page } }),
|
||||
body: JSON.stringify({ q: filter.q, options: { filter: filterText, sort: [`${filter.sort}:${filter.sortOrder == "+" ? "asc" : "desc"}`], hitsPerPage: 21, page: page } }),
|
||||
});
|
||||
|
||||
const result = await r.json();
|
||||
@@ -369,11 +369,11 @@ function buildFilterText(filter: TrailFilter, includeGeo: boolean): string {
|
||||
|
||||
filterText += ` AND difficulty IN [${filter.difficulty.join(",")}]`
|
||||
|
||||
if(filter.startDate) {
|
||||
if (filter.startDate) {
|
||||
filterText += ` AND date >= ${new Date(filter.startDate).getTime() / 1000}`
|
||||
}
|
||||
|
||||
if(filter.endDate) {
|
||||
if (filter.endDate) {
|
||||
filterText += ` AND date <= ${new Date(filter.endDate).getTime() / 1000}`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user