improved loading for change individual anime from search

This commit is contained in:
2024-09-09 12:03:46 -04:00
parent 45b11fa8f4
commit 60a38ff569
9 changed files with 123 additions and 33 deletions

View File

@ -1,6 +1,5 @@
<script lang="ts">
import {
aniListLoggedIn,
aniListAnime,
GetAniListSingleItem,
} from "./helperModules/GlobalVariablesAndHelperFunctions.svelte";
@ -13,6 +12,8 @@
import {CheckIfAniListLoggedInAndLoadWatchList} from "./helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
import { CheckIfMALLoggedInAndSetUser } from "./helperModules/CheckIfMyAnimeListLoggedIn.svelte";
import {CheckIfSimklLoggedInAndSetUser} from "./helperModules/CheckIsSimklLoggedIn.svelte"
import {CheckIfAniListLoggedIn} from "../wailsjs/go/main/App";
import {AniListGetSingleAnimeDefaultData} from "./helperDefaults/AniListGetSingleAnime";
onMount(async () => {
await CheckIfAniListLoggedInAndLoadWatchList()
@ -25,10 +26,15 @@
<Router routes={{
'/': Home,
'/anime/:id': wrap({
asyncComponent: () => import('./routes/Anime.svelte'),
asyncComponent: () => import('./routes/AnimeRoutePage.svelte'),
conditions: [
() => $aniListLoggedIn,
async () => await CheckIfAniListLoggedIn(),
async (detail) => {
console.log("reached condition")
aniListAnime.update(value => {
value = AniListGetSingleAnimeDefaultData
return value
})
await GetAniListSingleItem(Number(detail.params.id), true)
return Object.keys($aniListAnime).length!==0
},