aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2022-05-31 01:09:58 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2022-05-31 01:09:58 +0200
commit6ccc6f60fc85e665c8a07a169efbe8d09c9d9e8e (patch)
tree87c397af49b7820b5fb2c0fa3037be2ac4a587e8 /src
parent852ee620f0a2f6a83cf83eba860ca951b66bb7e2 (diff)
Lint, rm unused code
Diffstat (limited to 'src')
-rw-r--r--src/lib/components/forum/forum.svelte11
-rw-r--r--src/lib/components/forum_list/forum_list.svelte4
-rw-r--r--src/lib/components/glyph/glyph.svelte12
-rw-r--r--src/lib/components/post/post.svelte33
-rw-r--r--src/lib/components/topic/topic.svelte19
-rw-r--r--src/lib/components/topic_summary/topic_summary.svelte6
-rw-r--r--src/lib/data/types.d.ts12
-rw-r--r--src/lib/stores/forums.ts21
-rw-r--r--src/lib/stores/posts.ts29
-rw-r--r--src/lib/stores/response_builder.ts40
-rw-r--r--src/lib/stores/supabase.ts50
-rw-r--r--src/lib/stores/tags.test.ts295
-rw-r--r--src/lib/stores/tags.ts13
-rw-r--r--src/lib/stores/topics.ts43
-rw-r--r--src/lib/stores/users.ts13
-rw-r--r--src/routes/a/[id].svelte4
-rw-r--r--src/routes/f/[id].svelte4
-rw-r--r--src/routes/g/[id].svelte4
-rw-r--r--src/routes/p/[id].svelte4
-rw-r--r--src/routes/t/[id].svelte4
20 files changed, 167 insertions, 454 deletions
diff --git a/src/lib/components/forum/forum.svelte b/src/lib/components/forum/forum.svelte
index e9841a9..e0a9ec5 100644
--- a/src/lib/components/forum/forum.svelte
+++ b/src/lib/components/forum/forum.svelte
@@ -1,6 +1,5 @@
<script lang="ts">
import type { Forum } from '$lib/data/types';
- import { topicsForForum } from '$lib/stores/topics';
export let forum: Forum;
@@ -10,9 +9,9 @@
<h1 class="py-4 font-bold text-3xl">{forum.glyph} {$_(forum.label)}</h1>
<ul class="list-disc list-inside pl-2">
- {#if forum.topics}
- {#each forum.topics as topic}
- <TopicSummary {topic} />
- {/each}
- {/if}
+ {#if forum.topics}
+ {#each forum.topics as topic}
+ <TopicSummary {topic} />
+ {/each}
+ {/if}
</ul>
diff --git a/src/lib/components/forum_list/forum_list.svelte b/src/lib/components/forum_list/forum_list.svelte
index d1518bd..c8b48bc 100644
--- a/src/lib/components/forum_list/forum_list.svelte
+++ b/src/lib/components/forum_list/forum_list.svelte
@@ -4,9 +4,7 @@
export let forums: Forum[];
import { _ } from 'svelte-i18n';
- $: sortedForums = forums
- .slice()
- .sort((a, b) => a.position - b.position);
+ $: sortedForums = forums.slice().sort((a, b) => a.position - b.position);
</script>
<ul class="p-0 pl-2">
diff --git a/src/lib/components/glyph/glyph.svelte b/src/lib/components/glyph/glyph.svelte
index 0726752..89bc10c 100644
--- a/src/lib/components/glyph/glyph.svelte
+++ b/src/lib/components/glyph/glyph.svelte
@@ -5,9 +5,17 @@
export let uuid: string;
</script>
-<div class="inline-block w-12 h-12 mt-1 bg-white border border-black border-solid p-0.5 box-content glyphicon" role="img" aria-label={$_('glyph.title')} title={$_('glyph.title')}>
+<div
+ class="inline-block w-12 h-12 mt-1 bg-white border border-black border-solid p-0.5 box-content glyphicon"
+ role="img"
+ aria-label={$_('glyph.title')}
+ title={$_('glyph.title')}
+>
{#each getGlyphHash(uuid) as fragment}
- <span class="block text-2xl float-left w-6 h-6 text-center leading-6 {fragment.glyph}" style="color: {fragment.color} ">
+ <span
+ class="block text-2xl float-left w-6 h-6 text-center leading-6 {fragment.glyph}"
+ style="color: {fragment.color} "
+ >
{fragment.glyph}
</span>
{/each}
diff --git a/src/lib/components/post/post.svelte b/src/lib/components/post/post.svelte
index b0f99e4..dfabdce 100644
--- a/src/lib/components/post/post.svelte
+++ b/src/lib/components/post/post.svelte
@@ -16,29 +16,40 @@
title={$_('post.metadata_title', { values: { count: index + 1, total: count } })}
>
<Glyph uuid={post.author_id} />
- {#if post.author}
- <span class="h-card">
- {$_('post.author_credit')}
- <a href="/a/{post.author.handle}" class="p-nickname u-url underline text-blue-600 visited:text-purple-500">{post.author.handle}</a>.
- </span>
- {:else}
- <span>????</span>
- {/if}
+ {#if post.author}
+ <span class="h-card">
+ {$_('post.author_credit')}
+ <a
+ href="/a/{post.author.handle}"
+ class="p-nickname u-url underline text-blue-600 visited:text-purple-500"
+ >{post.author.handle}</a
+ >.
+ </span>
+ {:else}
+ <span>????</span>
+ {/if}
<time role="presentation" class="dt-published" datetime={timestampToISO(post.created_at)}>
- <a title={$_('post.permalink_title')} class="underline text-blue-600 visited:text-purple-500" href="/p/{post.id}">
+ <a
+ title={$_('post.permalink_title')}
+ class="underline text-blue-600 visited:text-purple-500"
+ href="/p/{post.id}"
+ >
{timestampToISO(post.created_at)}
</a>
</time>
{#if post.topic}
<span>
- ({$_('post.topic_location')} <a class="text-blue-600 underline visited:text-purple-500" href="/t/{post.topic.id}">{post.topic.title}</a>.)
+ ({$_('post.topic_location')}
+ <a class="text-blue-600 underline visited:text-purple-500" href="/t/{post.topic.id}"
+ >{post.topic.title}</a
+ >.)
</span>
{/if}
</aside>
<article
class="e-content whitespace-pre"
title={$_('post.title', {
- values: { count: index + 1, total: count, author: post.author?.handle || '????' }
+ values: { count: index + 1, total: count, author: post.author?.handle || '????' }
})}
>
{post.text}
diff --git a/src/lib/components/topic/topic.svelte b/src/lib/components/topic/topic.svelte
index 0715857..7fb4101 100644
--- a/src/lib/components/topic/topic.svelte
+++ b/src/lib/components/topic/topic.svelte
@@ -17,14 +17,21 @@
{#if topic.forum}
<span class="topic-location">
{$_('topic.category_location')}
- <a href="/f/{topic.forum.id}" class="p-category underline text-blue-600 visited:text-purple-500">
+ <a
+ href="/f/{topic.forum.id}"
+ class="p-category underline text-blue-600 visited:text-purple-500"
+ >
{topic.forum.glyph}
{$_(topic.forum.label)}
</a>.
</span>
{/if}
<span class="topic-ttl">
- <a class="u-url u-uid underline text-blue-600 visited:text-purple-500" title={$_('topic.permalink_title')} href="/t/{topic.id}">
+ <a
+ class="u-url u-uid underline text-blue-600 visited:text-purple-500"
+ title={$_('topic.permalink_title')}
+ href="/t/{topic.id}"
+ >
({$_('topic.remaining_time', {
values: { remaining: $_(remaining.label, { values: { count: remaining.count } }) }
})})
@@ -37,13 +44,13 @@
{#each topic.tags as tag}
<a href="/g/{tag.tag}" class="p-category underline text-blue-600 visited:text-purple-500">
{tag.tag}<span class="tag-weight">({tag.count})</span></a
- >{' '}
+ >{' '}
{/each}
</aside>
{/if}
{#if topic.posts}
- {#each topic.posts as post, index}
- <Post {post} {index} count={topic.posts.length} />
- {/each}
+ {#each topic.posts as post, index}
+ <Post {post} {index} count={topic.posts.length} />
+ {/each}
{/if}
</div>
diff --git a/src/lib/components/topic_summary/topic_summary.svelte b/src/lib/components/topic_summary/topic_summary.svelte
index d54a195..8c4df4d 100644
--- a/src/lib/components/topic_summary/topic_summary.svelte
+++ b/src/lib/components/topic_summary/topic_summary.svelte
@@ -12,7 +12,11 @@
<li class="h-entry" title={$_('topic.title')}>
<span class="p-name">
- <a class="u-url u-uid underline text-blue-600 visited:text-purple-500" title={$_('topic.permalink_title')} href="/t/{topic.id}">
+ <a
+ class="u-url u-uid underline text-blue-600 visited:text-purple-500"
+ title={$_('topic.permalink_title')}
+ href="/t/{topic.id}"
+ >
{topic.title}
</a></span
>
diff --git a/src/lib/data/types.d.ts b/src/lib/data/types.d.ts
index aae2f80..e1f6f17 100644
--- a/src/lib/data/types.d.ts
+++ b/src/lib/data/types.d.ts
@@ -8,10 +8,10 @@ export type Topic = {
title: string;
ttl: number;
updated_at: number;
- forum_id: string;
- forum?: Forum;
- posts?: Post[];
- tags?: Tag[];
+ forum_id: string;
+ forum?: Forum;
+ posts?: Post[];
+ tags?: Tag[];
};
export type Post = {
@@ -21,8 +21,8 @@ export type Post = {
text: string;
topic_id: string;
topic?: Topic;
- author_id: string;
- author?: User;
+ author_id: string;
+ author?: User;
};
export type Tag = {
diff --git a/src/lib/stores/forums.ts b/src/lib/stores/forums.ts
index 40a3f2c..0bf41f6 100644
--- a/src/lib/stores/forums.ts
+++ b/src/lib/stores/forums.ts
@@ -1,4 +1,4 @@
-import { createClient } from '@supabase/supabase-js'
+import { createClient } from '@supabase/supabase-js';
import { single, collection } from './supabase';
import { supabase } from '$lib/config/config';
@@ -6,13 +6,20 @@ import type { Forum } from '$lib/data/types';
const client = createClient(supabase.url, supabase.key);
-export const forum = (id: string, withTopics = false) => single<Forum>(client
- .from('forums')
- .select(withTopics ? `*,
+export const forum = (id: string, withTopics = false) =>
+ single<Forum>(
+ client
+ .from('forums')
+ .select(
+ withTopics
+ ? `*,
topics (
*
)
- `: '*' )
- .eq('id', id),
- null);
+ `
+ : '*'
+ )
+ .eq('id', id),
+ null
+ );
export const forums = collection<Forum>(client.from('forums').select('*'), []);
diff --git a/src/lib/stores/posts.ts b/src/lib/stores/posts.ts
index f592dca..388eed3 100644
--- a/src/lib/stores/posts.ts
+++ b/src/lib/stores/posts.ts
@@ -1,23 +1,24 @@
-import { createClient } from '@supabase/supabase-js'
-import { single, collection } from './supabase';
+import { createClient } from '@supabase/supabase-js';
+import { single } from './supabase';
import { supabase } from '$lib/config/config';
import type { Post } from '$lib/data/types';
const client = createClient(supabase.url, supabase.key);
-export const post = (id: string, withTopic = false) => single<Post>(client
- .from('posts')
- .select(withTopic ? `*,
+export const post = (id: string, withTopic = false) =>
+ single<Post>(
+ client
+ .from('posts')
+ .select(
+ withTopic
+ ? `*,
topic:topic_id (
*
)
- `: '*' )
- .eq('id', id),
- null);
-export const postsForTopic = (id: string) => collection<Post>(client
- .from('posts')
- .select('*')
- .eq('topic_id', id)
- .order('created_at', { ascending: true }),
- []);
+ `
+ : '*'
+ )
+ .eq('id', id),
+ null
+ );
diff --git a/src/lib/stores/response_builder.ts b/src/lib/stores/response_builder.ts
index 1e12243..91e8d0f 100644
--- a/src/lib/stores/response_builder.ts
+++ b/src/lib/stores/response_builder.ts
@@ -3,8 +3,8 @@
*/
interface AnyError {
- message: string
-};
+ message: string;
+}
export type StoreState<Type> = {
loading: boolean;
@@ -12,26 +12,26 @@ export type StoreState<Type> = {
error: AnyError | void;
};
-export function initialResponse<T> (initialState: T): StoreState<T> {
- return {
- loading: true,
- data: initialState,
- error: undefined
- };
+export function initialResponse<T>(initialState: T): StoreState<T> {
+ return {
+ loading: true,
+ data: initialState,
+ error: undefined
+ };
}
-export function errorResponse<T> (error: AnyError): StoreState<T> {
- return {
- loading: false,
- data: undefined,
- error
- };
+export function errorResponse<T>(error: AnyError): StoreState<T> {
+ return {
+ loading: false,
+ data: undefined,
+ error
+ };
}
-export function response<T> (data: T): StoreState<T> {
- return {
- loading: false,
- data,
- error: undefined
- };
+export function response<T>(data: T): StoreState<T> {
+ return {
+ loading: false,
+ data,
+ error: undefined
+ };
}
diff --git a/src/lib/stores/supabase.ts b/src/lib/stores/supabase.ts
index 804141f..5bcd941 100644
--- a/src/lib/stores/supabase.ts
+++ b/src/lib/stores/supabase.ts
@@ -5,34 +5,36 @@ import type { Readable } from 'svelte/store';
import type { PostgrestFilterBuilder } from '@supabase/postgrest-js';
import type { StoreState } from './response_builder';
-export function collection<T> (query: PostgrestFilterBuilder<T>, initialValue: T[]): Readable<StoreState<T[]>> {
+export function collection<T>(
+ query: PostgrestFilterBuilder<T>,
+ initialValue: T[]
+): Readable<StoreState<T[]>> {
+ return readable(initialResponse<T[]>(initialValue), (set) => {
+ (async function () {
+ const { data, error } = await query;
- return readable(initialResponse<T[]>(initialValue), (set) => {
+ if (error) {
+ return set(errorResponse<T[]>(error));
+ }
- (async function() {
- const { data, error } = await query;
-
- if (error) {
- return set(errorResponse<T[]>(error));
- }
-
- set(response<T[]>(data));
- })()
- });
+ set(response<T[]>(data));
+ })();
+ });
}
-export function single<T> (query: PostgrestFilterBuilder<T>, initialValue: T): Readable<StoreState<T>> {
-
- return readable(initialResponse<T>(initialValue), (set) => {
-
- (async function() {
- const { data, error } = await query.single();
+export function single<T>(
+ query: PostgrestFilterBuilder<T>,
+ initialValue: T
+): Readable<StoreState<T>> {
+ return readable(initialResponse<T>(initialValue), (set) => {
+ (async function () {
+ const { data, error } = await query.single();
- if (error) {
- return set(errorResponse<T>(error));
- }
+ if (error) {
+ return set(errorResponse<T>(error));
+ }
- set(response<T>(data));
- })()
- });
+ set(response<T>(data));
+ })();
+ });
}
diff --git a/src/lib/stores/tags.test.ts b/src/lib/stores/tags.test.ts
deleted file mode 100644
index 8c9effe..0000000
--- a/src/lib/stores/tags.test.ts
+++ /dev/null
@@ -1,295 +0,0 @@
-import { GraphQLInteraction, Pact, Matchers } from '@pact-foundation/pact';
-import { resolve } from 'path';
-
-import { resolveAfter } from '$lib/utils/resolve_after';
-
-const { eachLike, like } = Matchers;
-
-jest.mock('$lib/config/config.ts');
-
-import { getTag } from './tags';
-
-const internals = {
- provider: null
-};
-
-describe('Tags store pact', () => {
- beforeAll(async () => {
- internals.provider = new Pact({
- port: 1234,
- dir: resolve(process.cwd(), 'pacts'),
- consumer: 'ForumClient',
- provider: 'ForumServer',
- pactfileWriteMode: 'update'
- });
-
- await internals.provider.setup();
- });
-
- afterEach(() => internals.provider.verify());
- afterAll(() => internals.provider.finalize());
-
- describe("When there's data", () => {
- describe('GetTag', () => {
- beforeAll(async () => {
- const tagQuery = new GraphQLInteraction()
- .given("there's data")
- .uponReceiving('a request to get a single tag')
- .withRequest({
- path: '/graphql',
- method: 'POST'
- })
- .withOperation('GetTag')
- .withQuery(
- `query GetTag($id: ID!) {
- tag(id: $id) {
- id
- topics {
- id
- title
- updated_at
- ttl
- __typename
- }
- __typename
- }
- }`
- )
- .withVariables({
- id: 'pineapple'
- })
- .willRespondWith({
- status: 200,
- headers: {
- 'Content-Type': 'application/json; charset=utf-8'
- },
- body: {
- data: {
- tag: {
- id: like('pineapple'),
- topics: eachLike({
- id: like('cd038ae7-e8b4-4e38-9543-3d697e69ac34'),
- title: like('This topic is about pineapples'),
- updated_at: like(1619978944077),
- ttl: like(3555)
- })
- }
- }
- }
- });
- return await internals.provider.addInteraction(tagQuery);
- });
-
- test('it returns the tag', async () => {
- const tag = getTag('pineapple');
- const { counter, promise: resolveAfterTwo } = resolveAfter(2);
- let response = null;
- tag.subscribe((tagValue) => {
- response = tagValue;
- counter();
- });
- expect(response.data).toBe(null);
- expect(response.loading).toBe(true);
- expect(response.error).toBe(undefined);
- await resolveAfterTwo;
- expect(response.data).toEqual({
- id: 'pineapple',
- topics: [
- {
- id: 'cd038ae7-e8b4-4e38-9543-3d697e69ac34',
- title: 'This topic is about pineapples',
- updated_at: 1619978944077,
- ttl: 3555
- }
- ]
- });
- expect(response.loading).toBe(false);
- expect(response.error).toBe(undefined);
- });
- });
- });
-
- describe("When there's no data", () => {
- describe('GetTag', () => {
- beforeAll(async () => {
- const tagQuery = new GraphQLInteraction()
- .given("there's no data")
- .uponReceiving('a request to get a single tag')
- .withRequest({
- path: '/graphql',
- method: 'POST'
- })
- .withOperation('GetTag')
- .withQuery(
- `query GetTag($id: ID!) {
- tag(id: $id) {
- id
- topics {
- id
- title
- updated_at
- ttl
- __typename
- }
- __typename
- }
- }`
- )
- .withVariables({
- id: 'pineapple'
- })
- .willRespondWith({
- status: 200,
- headers: {
- 'Content-Type': 'application/json; charset=utf-8'
- },
- body: {
- data: {
- tag: null
- }
- }
- });
- return await internals.provider.addInteraction(tagQuery);
- });
-
- test('it returns the tag', async () => {
- const tag = getTag('pineapple');
- const { counter, promise: resolveAfterTwo } = resolveAfter(2);
- let response = null;
- tag.subscribe((tagValue) => {
- response = tagValue;
- counter();
- });
- expect(response.data).toBe(null);
- expect(response.loading).toBe(true);
- expect(response.error).toBe(undefined);
- await resolveAfterTwo;
- expect(response.data).toBe(null);
- expect(response.loading).toBe(false);
- expect(response.error).toBe(undefined);
- });
- });
- });
-
- describe("When there's a server error", () => {
- describe('GetTag', () => {
- beforeAll(async () => {
- const tagQuery = new GraphQLInteraction()
- .given("there's a server error")
- .uponReceiving('a request to get a single tag')
- .withRequest({
- path: '/graphql',
- method: 'POST'
- })
- .withOperation('GetTag')
- .withQuery(
- `query GetTag($id: ID!) {
- tag(id: $id) {
- id
- topics {
- id
- title
- updated_at
- ttl
- __typename
- }
- __typename
- }
- }`
- )
- .withVariables({
- id: 'pineapple'
- })
- .willRespondWith({
- status: 500
- });
- return await internals.provider.addInteraction(tagQuery);
- });
-
- test('it returns the error', async () => {
- const tag = getTag('pineapple');
- const { counter, promise: resolveAfterTwo } = resolveAfter(2);
- let response = null;
- tag.subscribe((tagValue) => {
- response = tagValue;
- counter();
- });
- expect(response.data).toBe(null);
- expect(response.loading).toBe(true);
- expect(response.error).toBe(undefined);
- await resolveAfterTwo;
- expect(response.data).toBe(null);
- expect(response.loading).toBe(false);
- expect(response.error).toBeInstanceOf(Error);
- });
- });
- });
-
- describe("When there's an error in the response", () => {
- describe('GetTag', () => {
- beforeAll(async () => {
- const tagQuery = new GraphQLInteraction()
- .given("there's an error in the response")
- .uponReceiving('a request to get a single tag')
- .withRequest({
- path: '/graphql',
- method: 'POST'
- })
- .withOperation('GetTag')
- .withQuery(
- `query GetTag($id: ID!) {
- tag(id: $id) {
- id
- topics {
- id
- title
- updated_at
- ttl
- __typename
- }
- __typename
- }
- }`
- )
- .withVariables({
- id: 'pineapple'
- })
- .willRespondWith({
- status: 200,
- headers: {
- 'Content-Type': 'application/json; charset=utf-8'
- },
- body: {
- errors: eachLike({
- message: like('An error occurred when fetching the tag')
- })
- }
- });
- return await internals.provider.addInteraction(tagQuery);
- });
-
- test('it returns the error', async () => {
- const tag = getTag('pineapple');
- const { counter, promise: resolveAfterTwo } = resolveAfter(2);
- let response = null;
- tag.subscribe((tagValue) => {
- response = tagValue;
- counter();
- });
- expect(response.data).toBe(null);
- expect(response.loading).toBe(true);
- expect(response.error).toBe(undefined);
- await resolveAfterTwo;
- expect(response.data).toBe(null);
- expect(response.loading).toBe(false);
- expect(response.error.graphQLErrors).toEqual(
- expect.arrayContaining([
- {
- message: 'An error occurred when fetching the tag'
- }
- ])
- );
- });
- });
- });
-});
diff --git a/src/lib/stores/tags.ts b/src/lib/stores/tags.ts
deleted file mode 100644
index 0b528e8..0000000
--- a/src/lib/stores/tags.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { createClient } from '@supabase/supabase-js'
-import { collection } from './supabase';
-import { supabase } from '$lib/config/config';
-
-import type { Tag } from '$lib/data/types';
-
-const client = createClient(supabase.url, supabase.key);
-
-export const tagsForTopic = (id: string) => collection<Tag>(client
- .from('topic_tags')
- .select('*')
- .eq('topic_id', id),
- []);
diff --git a/src/lib/stores/topics.ts b/src/lib/stores/topics.ts
index 04c1e9e..1842a4d 100644
--- a/src/lib/stores/topics.ts
+++ b/src/lib/stores/topics.ts
@@ -1,4 +1,4 @@
-import { createClient } from '@supabase/supabase-js'
+import { createClient } from '@supabase/supabase-js';
import { single, collection } from './supabase';
import { supabase } from '$lib/config/config';
@@ -6,27 +6,34 @@ import type { Topic } from '$lib/data/types';
const client = createClient(supabase.url, supabase.key);
-export const topic = (id: string, withPosts = false) => single<Topic>(client
- .from('topics')
- .select(withPosts ? `*,
+export const topic = (id: string, withPosts = false) =>
+ single<Topic>(
+ client
+ .from('topics')
+ .select(
+ withPosts
+ ? `*,
forum: forums (*),
tags: topic_tags (*),
posts (
*,
author:author_id (*)
)
- `: '*' )
- .eq('id', id),
- null);
-export const topicsForForum = (id: string) => collection<Topic>(client
- .from('topics')
- .select('*')
- .eq('forum_id', id),
- []);
-export const topicsForTag = (id: string) => collection<Topic>(client
- .from('topics')
- .select(`
+ `
+ : '*'
+ )
+ .eq('id', id),
+ null
+ );
+export const topicsForTag = (id: string) =>
+ collection<Topic>(
+ client
+ .from('topics')
+ .select(
+ `
*,tags!inner(*)
- `)
- .eq('tags.tag', id),
- []);
+ `
+ )
+ .eq('tags.tag', id),
+ []
+ );
diff --git a/src/lib/stores/users.ts b/src/lib/stores/users.ts
deleted file mode 100644
index 2a56cb5..0000000
--- a/src/lib/stores/users.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { createClient } from '@supabase/supabase-js'
-import { single } from './supabase';
-import { supabase } from '$lib/config/config';
-
-import type { User } from '$lib/data/types';
-
-const client = createClient(supabase.url, supabase.key);
-
-export const user = (id: string) => single<User>(client
- .from('users')
- .select('*')
- .eq('id', id),
- null);
diff --git a/src/routes/a/[id].svelte b/src/routes/a/[id].svelte
index 6f5a3db..524535e 100644
--- a/src/routes/a/[id].svelte
+++ b/src/routes/a/[id].svelte
@@ -1,7 +1,5 @@
<script lang="ts" context="module">
- export const load = ({
- params: { id }
- }) => ({ props: { id } });
+ export const load = ({ params: { id } }) => ({ props: { id } });
</script>
<script lang="ts">
diff --git a/src/routes/f/[id].svelte b/src/routes/f/[id].svelte
index 103e8f8..64f5c85 100644
--- a/src/routes/f/[id].svelte
+++ b/src/routes/f/[id].svelte
@@ -1,7 +1,5 @@
<script lang="ts" context="module">
- export const load = ({
- params: { id }
- }) => ({ props: { id } });
+ export const load = ({ params: { id } }) => ({ props: { id } });
</script>
<script lang="ts">
diff --git a/src/routes/g/[id].svelte b/src/routes/g/[id].svelte
index 2033f14..ff45b51 100644
--- a/src/routes/g/[id].svelte
+++ b/src/routes/g/[id].svelte
@@ -1,7 +1,5 @@
<script lang="ts" context="module">
- export const load = ({
- params: { id }
- }) => ({ props: { id } });
+ export const load = ({ params: { id } }) => ({ props: { id } });
</script>
<script lang="ts">
diff --git a/src/routes/p/[id].svelte b/src/routes/p/[id].svelte
index bbf6396..47755be 100644
--- a/src/routes/p/[id].svelte
+++ b/src/routes/p/[id].svelte
@@ -1,7 +1,5 @@
<script lang="ts" context="module">
- export const load = ({
- params: { id }
- }) => ({ props: { id } });
+ export const load = ({ params: { id } }) => ({ props: { id } });
</script>
<script lang="ts">
diff --git a/src/routes/t/[id].svelte b/src/routes/t/[id].svelte
index 45cc63e..b7a067b 100644
--- a/src/routes/t/[id].svelte
+++ b/src/routes/t/[id].svelte
@@ -1,7 +1,5 @@
<script lang="ts" context="module">
- export const load = ({
- params: { id }
- }) => ({ props: { id } });
+ export const load = ({ params: { id } }) => ({ props: { id } });
</script>
<script lang="ts">