adds error logging for recommend api

This commit is contained in:
Christian Beutel
2025-02-16 23:20:53 +01:00
parent f95ad749be
commit b1f1ae6c1e
2 changed files with 8 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ import type { Trail } from '$lib/models/trail';
import { pb } from '$lib/pocketbase';
import { handleError } from '$lib/util/api_util';
import { error, json, type RequestEvent } from '@sveltejs/kit';
import { ClientResponseError } from 'pocketbase';
export async function GET(event: RequestEvent) {
try {
@@ -13,6 +14,12 @@ export async function GET(event: RequestEvent) {
size: safeSearchParams.size?.toString() ?? ""
})));
if (!r.ok) {
const response = await r.json()
console.error(response)
throw new ClientResponseError({ status: response.code, response })
}
const result: Trail[] = await r.json();
for (const t of result) {

View File

@@ -126,7 +126,7 @@
{loading}>Login</Button
>
</div>
{#if env.PUBLIC_DISABLE_SIGNUP === "false"}
{#if env.PUBLIC_DISABLE_SIGNUP !== "true"}
<span
>{$_("no-account")}
<a class="text-blue-500 underline" href="/register"