aboutsummaryrefslogtreecommitdiff
path: root/src/routes/reader/+page.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/reader/+page.svelte')
-rw-r--r--src/routes/reader/+page.svelte62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/routes/reader/+page.svelte b/src/routes/reader/+page.svelte
index 98c3ae1c..775d3659 100644
--- a/src/routes/reader/+page.svelte
+++ b/src/routes/reader/+page.svelte
@@ -1,38 +1,38 @@
<script>
- import Notice from '$lib/Error/Notice.svelte';
- import Message from '$lib/Loading/Message.svelte';
- import MangaDexChapters from '$lib/Reader/Chapters/MangaDex.svelte';
- import RawkumaChapters from '$lib/Reader/Chapters/Rawkuma.svelte';
- import { decodeResource, fetchResource, identify, Resource } from '$lib/Reader/resource';
- import InputTemplate from '$lib/Tools/InputTemplate.svelte';
+ import Notice from '$lib/Error/Notice.svelte';
+ import Message from '$lib/Loading/Message.svelte';
+ import MangaDexChapters from '$lib/Reader/Chapters/MangaDex.svelte';
+ import RawkumaChapters from '$lib/Reader/Chapters/Rawkuma.svelte';
+ import { decodeResource, fetchResource, identify, Resource } from '$lib/Reader/resource';
+ import InputTemplate from '$lib/Tools/InputTemplate.svelte';
- let submission = '';
+ let submission = '';
- $: resourceIdentity = identify(submission);
+ $: resourceIdentity = identify(submission);
</script>
<InputTemplate field="Manga URL" bind:submission submitText="Read" preserveCase>
- {#if resourceIdentity}
- {#await fetchResource(submission)}
- <Message message="Loading chapters ..." />
- {:then response}
- {#if response.ok}
- {#await decodeResource(response, submission) then data}
- {#if resourceIdentity === Resource.MangaDex}
- <MangaDexChapters {data} />
- {:else if resourceIdentity === Resource.Rawkuma}
- <RawkumaChapters {data} />
- {/if}
- {:catch error}
- <Notice>{error}</Notice>
- {/await}
- {:else}
- <Notice>Failed to fetch data</Notice>
- {/if}
- {:catch}
- <Notice>An unknown error has occurred.</Notice>
- {/await}
- {:else}
- <Notice>Invalid URL</Notice>
- {/if}
+ {#if resourceIdentity}
+ {#await fetchResource(submission)}
+ <Message message="Loading chapters ..." />
+ {:then response}
+ {#if response.ok}
+ {#await decodeResource(response, submission) then data}
+ {#if resourceIdentity === Resource.MangaDex}
+ <MangaDexChapters {data} />
+ {:else if resourceIdentity === Resource.Rawkuma}
+ <RawkumaChapters {data} />
+ {/if}
+ {:catch error}
+ <Notice>{error}</Notice>
+ {/await}
+ {:else}
+ <Notice>Failed to fetch data</Notice>
+ {/if}
+ {:catch}
+ <Notice>An unknown error has occurred.</Notice>
+ {/await}
+ {:else}
+ <Notice>Invalid URL</Notice>
+ {/if}
</InputTemplate>