generated from prokawsar/dashboard-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Readme update * server action loader * Fix test * GlobalTeardown for playwright
- Loading branch information
Showing
11 changed files
with
110 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script lang="ts"> | ||
import Loader from '$lib/elements/Loader.svelte' | ||
</script> | ||
|
||
<div class="absolute bg-white bg-opacity-80 flex h-full w-full items-center justify-center z-10"> | ||
<Loader /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
<script lang="ts"> | ||
import { enhance } from '$app/forms' | ||
import Button from '$lib/elements/Button.svelte' | ||
import FullPageLoader from '$lib/elements/FullPageLoader.svelte' | ||
import Input from '$lib/elements/Input.svelte' | ||
import { redirect } from '@sveltejs/kit' | ||
export let data | ||
export let form | ||
$: ({ supabase } = data) | ||
let email = form?.email || '' | ||
let password = '' | ||
let loading = false | ||
const handleOAuthLogin = async () => { | ||
const { data, error } = await supabase.auth.signInWithOAuth({ | ||
|
@@ -17,11 +21,9 @@ | |
redirectTo: `http://localhost:2000/auth/callback/` | ||
} | ||
}) | ||
if (error) { | ||
return | ||
} | ||
return redirect(300, data.url) | ||
} | ||
</script> | ||
|
@@ -40,7 +42,18 @@ | |
{form?.message ? form?.message : ''} | ||
</p> | ||
|
||
<form method="post" action="?/login" class="flex w-full flex-col gap-3 items-center"> | ||
<form | ||
method="post" | ||
action="?/login" | ||
class="flex w-full flex-col gap-3 items-center" | ||
use:enhance={() => { | ||
loading = true | ||
return async ({ update }) => { | ||
await update() | ||
loading = false | ||
} | ||
}} | ||
> | ||
<Input | ||
required | ||
type="email" | ||
|
@@ -66,3 +79,7 @@ | |
Contact: <email>[email protected]</email> | ||
</p> | ||
</section> | ||
|
||
{#if loading} | ||
<FullPageLoader /> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { createClient } from '@supabase/supabase-js' | ||
|
||
export const supabase = createClient( | ||
process.env.PUBLIC_SUPABASE_URL || '', | ||
process.env.PUBLIC_SUPABASE_ANON || '' | ||
) | ||
|
||
export default async function globalTeardown() { | ||
await performCleanup() | ||
} | ||
|
||
async function performCleanup() { | ||
console.log('Performing cleanup...') | ||
await deleteAllHistory() | ||
await emptyTrashData() | ||
} | ||
|
||
// For cleanup after test | ||
export const deleteAllHistory = async () => { | ||
const response = await supabase | ||
.from('history') | ||
.delete() | ||
.eq('user', '1d2d6d58-1f0a-44d2-bba2-2bdf60c584b6') | ||
return response | ||
} | ||
|
||
export const emptyTrashData = async () => { | ||
const response = await supabase.from('history').delete().not('deleted_at', 'is', null) | ||
return response | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters