Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0090334
commit 2b0bf24
Showing
12 changed files
with
63 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { SupabaseClient } from '@supabase/supabase-js'; | ||
import type { Database } from '../../supabase/database.types'; | ||
|
||
const GetUserDevices = (supabase: SupabaseClient<Database>) => async (owner: string) => { | ||
const { data, error } = await supabase.from('device').select().eq('owner', owner); | ||
|
||
if (error) { | ||
console.error(error); | ||
} | ||
|
||
return data; | ||
}; | ||
|
||
export default GetUserDevices; |
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
import GetUserDevices from './getUserDevices'; | ||
|
||
export { GetUserDevices }; |
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 +1 @@ | ||
<div>WIP: Home</div> | ||
<h1>This is the Home Page of the Svelte Boilerplate</h1> |
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 +1 @@ | ||
<div>WIP: About</div> | ||
<h1>This is the About Page of the Svelte Boilerplate</h1> |
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,18 +1,18 @@ | ||
<script lang="ts"> | ||
import type { PageData } from './$types'; | ||
export let data: PageData; | ||
$: ({ devices } = data); | ||
import type { PageData } from './$types'; | ||
export let data: PageData; | ||
$: ({ devices } = data); | ||
</script> | ||
|
||
<div>WIP: Devices</div> | ||
|
||
{#if devices?.length} | ||
<ul> | ||
{#each devices as device} | ||
<li>{device.name}</li> | ||
{/each} | ||
</ul> | ||
<ul> | ||
{#each devices as device} | ||
<li>{device.name}</li> | ||
{/each} | ||
</ul> | ||
{:else} | ||
<div>No devices found</div> | ||
{/if} | ||
<div>No devices found</div> | ||
{/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import { GetUserDevices } from '$lib/features/device'; | ||
import { redirect } from '@sveltejs/kit'; | ||
import GetUserDevices from "../../lib/features/device/getUserDevices/getUserDevices"; | ||
import type { PageLoad } from './$types'; | ||
|
||
export const load: PageLoad = async ({ parent }) => { | ||
const { supabase, session } = await parent(); | ||
if (!session) { | ||
throw redirect(303, '/'); | ||
} | ||
const { supabase, session } = await parent(); | ||
if (!session) { | ||
throw redirect(303, '/'); | ||
} | ||
|
||
const getUserDevices = GetUserDevices(supabase); | ||
const devices = await getUserDevices(session.user.id); | ||
const getUserDevices = GetUserDevices(supabase); | ||
const devices = await getUserDevices(session.user.id); | ||
|
||
return { | ||
devices | ||
}; | ||
}; | ||
return { | ||
devices | ||
}; | ||
}; |
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