Skip to content

Commit

Permalink
fix: improve pocketbase url for local dev env
Browse files Browse the repository at this point in the history
  • Loading branch information
HuakunShen committed Dec 28, 2024
1 parent bc8ba27 commit d39c6ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion apps/web/src/lib/pb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import PocketBase from 'pocketbase';
import type { TypedPocketBase } from './pocketbase-types';
import { dev } from '$app/environment';

export const pb = new PocketBase() as TypedPocketBase;
export const pb = new PocketBase(dev ? 'http://localhost:8090' : undefined) as TypedPocketBase;
14 changes: 8 additions & 6 deletions apps/web/src/routes/auth/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { toast } from 'svelte-sonner';
import * as Popover from '$lib/components/ui/popover/index.js';
import { goto } from '$app/navigation';
import { dev } from '$app/environment';
import { page } from '$app/state';
let email = $state('');
Expand Down Expand Up @@ -47,12 +48,13 @@
<Info />
</Popover.Trigger>
<Popover.Content class="w-80">
{@const pbAdminUrl = dev
? 'http://localhost:8090'
: page.url.protocol + '//' + page.url.host + '/_/'}
<Card.Description
>Account can only be created by admin from <a
target="_blank"
href={`${page.url.protocol}//${page.url.host}/_/`}
>{page.url.protocol}//{page.url.host}/_/</a
>
>Account can only be created by admin from <a target="_blank" href={pbAdminUrl}>
{pbAdminUrl}
</a>
</Card.Description>
</Popover.Content>
</Popover.Root>
Expand All @@ -62,7 +64,7 @@
<div class="grid w-full items-center gap-4">
<div class="flex flex-col space-y-1.5">
<Label for="email">Email</Label>
<Input id="email" placeholder="Email" bind:value={email} />
<Input id="email" placeholder="Email" bind:value={email} autofocus />
</div>
<div class="flex flex-col space-y-1.5">
<Label for="password">Password</Label>
Expand Down

0 comments on commit d39c6ee

Please sign in to comment.