improved loading for change individual anime from search
This commit is contained in:
@ -11,21 +11,24 @@
|
||||
watchListPage.subscribe(value => page = value)
|
||||
animePerPage.subscribe(value => perPage = value)
|
||||
|
||||
export const CheckIfAniListLoggedInAndLoadWatchList = async () => {
|
||||
await CheckIfAniListLoggedIn().then(loggedIn => {
|
||||
if (loggedIn) {
|
||||
GetAniListLoggedInUser().then(user => {
|
||||
aniListUser.set(user)
|
||||
if (isAniListPrimary) {
|
||||
GetAniListUserWatchingList(page, perPage, MediaListSort.UpdatedTimeDesc).then((watchList) => {
|
||||
aniListWatchlist.set(watchList)
|
||||
aniListLoggedIn.set(loggedIn)
|
||||
})
|
||||
} else {
|
||||
aniListLoggedIn.set(loggedIn)
|
||||
}
|
||||
})
|
||||
}
|
||||
export const LoadAniListUser = async () => {
|
||||
await GetAniListLoggedInUser().then(user => {
|
||||
aniListUser.set(user)
|
||||
})
|
||||
}
|
||||
|
||||
export const LoadAniListWatchList = async () => {
|
||||
await GetAniListUserWatchingList(page, perPage, MediaListSort.UpdatedTimeDesc).then((watchList) => {
|
||||
aniListWatchlist.set(watchList)
|
||||
})
|
||||
}
|
||||
|
||||
export const CheckIfAniListLoggedInAndLoadWatchList = async () => {
|
||||
const loggedIn = await CheckIfAniListLoggedIn()
|
||||
if (loggedIn) {
|
||||
await LoadAniListUser()
|
||||
if (isAniListPrimary) await LoadAniListWatchList()
|
||||
}
|
||||
aniListLoggedIn.set(loggedIn)
|
||||
}
|
||||
</script>
|
@ -21,8 +21,9 @@
|
||||
import {type AniListUser, MediaListSort} from "../anilist/types/AniListTypes";
|
||||
import type {MALAnime, MALWatchlist, MyAnimeListUser} from "../mal/types/MALTypes";
|
||||
import type {TableItems} from "../helperTypes/TableTypes";
|
||||
import {AniListGetSingleAnimeDefaultData} from "../helperDefaults/AniListGetSingleAnime";
|
||||
|
||||
export let aniListAnime = writable({} as AniListGetSingleAnime)
|
||||
export let aniListAnime = writable(AniListGetSingleAnimeDefaultData)
|
||||
export let title = writable("")
|
||||
export let aniListLoggedIn = writable(false)
|
||||
export let simklLoggedIn = writable(false)
|
||||
|
Reference in New Issue
Block a user