Skip to content

Commit

Permalink
Fix login redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
massimobiagioli committed Mar 24, 2023
1 parent 6b35658 commit 76de96d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"dev": "vite dev --debug=9229",
"build": "vite build",
"preview": "vite preview",
"test": "playwright test",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/shared/supabase/auth.ts
Expand Up @@ -3,11 +3,11 @@ import type { Database } from './database.types';

export default function createAuth(supabase: SupabaseClient<Database>) {
return {
async signInWithEmail(email: string, emailRedirectTo: string): Promise<AuthResponse> {
async signInWithEmail(email: string): Promise<AuthResponse> {
return supabase.auth.signInWithOtp({
email,
options: {
emailRedirectTo
emailRedirectTo: window.location.origin
}
});
},
Expand Down
2 changes: 1 addition & 1 deletion src/routes/login/+page.svelte
Expand Up @@ -13,7 +13,7 @@
async function handleSubmit(e: SubmitEvent) {
const formData = new FormData(e.target as HTMLFormElement);
const auth = createAuth(data.supabase);
const { error } = await auth.signInWithEmail(formData.get('email') as string, '/');
const { error } = await auth.signInWithEmail(formData.get('email') as string);
if (error) {
showError = true;
console.log(error);
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/devices.test.ts
@@ -0,0 +1,8 @@
import { expect, test } from '@playwright/test';

test('devices', async ({ page }) => {
await page.goto('/devices');
await expect(
page.getByRole('heading', { name: 'This is the Home Page of the Svelte Boilerplate' })
).toBeVisible();
});

1 comment on commit 76de96d

@vercel
Copy link

@vercel vercel bot commented on 76de96d Mar 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.