fixes serverside pb usage

This commit is contained in:
Christian Beutel
2025-04-18 14:15:20 +02:00
parent 5024ade9ba
commit 69a5bbb5b9
7 changed files with 15 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
import { SummitLog, type SummitLogFilter } from "$lib/models/summit_log";
import { APIError } from "$lib/util/api_util";
import { type ListResult } from "pocketbase";
import { type AuthRecord, type ListResult } from "pocketbase";
import { get, writable, type Writable } from "svelte/store";
import { currentUser } from "./user_store";
@@ -45,8 +45,8 @@ export async function summit_logs_index(author: string, filter?: SummitLogFilter
return fetchedSummitLogs;
}
export async function summit_logs_create(summitLog: SummitLog, f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch) {
const user = get(currentUser)
export async function summit_logs_create(summitLog: SummitLog, f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch, user?: AuthRecord) {
user ??= get(currentUser)
if (!user) {
throw Error("Unauthenticated")
}