Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Commit 991acd0

Browse files
authored
Merge pull request #10 from DvdQzd/master
Issue 5 - episode number in URL
2 parents 4a2bb03 + 4dbbecc commit 991acd0

File tree

3 files changed

+76
-3
lines changed

3 files changed

+76
-3
lines changed

src/App.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import EpisodeListSection from "./sections/EpisodeListSection.svelte";
33
import IntroSection from "./sections/IntroSection.svelte";
4-
import { getEpisodeById, getLatestEpisode } from "./libs/episodes-repo";
4+
import { getEpisodeById, getEpisodeByNumber, getLatestEpisode } from "./libs/episodes-repo";
55
import EpisodeSection from "./sections/EpisodeSection.svelte";
66
import MetaSection from "./sections/MetaSection.svelte";
77
import AboutSection from "./sections/AboutSection.svelte";
@@ -33,7 +33,10 @@
3333
3434
function getEpisodeFromSearchKeys(keys: string[]) {
3535
const episodeId = keys.find(getEpisodeById);
36-
return getEpisodeById(episodeId) ?? getLatestEpisode();
36+
const episodeNumber = searchParams.get("episode");
37+
return getEpisodeByNumber(episodeNumber) ??
38+
getEpisodeById(episodeId) ??
39+
getLatestEpisode();
3740
}
3841
3942
function onstatechanged() {

0 commit comments

Comments
 (0)