added getting MAL watchlist

This commit is contained in:
2024-08-15 21:27:31 -04:00
parent f9c6f4b827
commit 22ff290a81
9 changed files with 252 additions and 22 deletions

View File

@@ -14,6 +14,7 @@
title,
watchListPage,
animePerPage,
malWatchList
} from "./GlobalVariablesAndHelperFunctions.svelte";
import {
CheckIfAniListLoggedIn,
@@ -23,7 +24,7 @@
GetAniListUserWatchingList,
GetSimklLoggedInUser,
SimklGetUserWatchlist,
GetMyAnimeListLoggedInUser,
GetMyAnimeListLoggedInUser, GetMyAnimeList,
} from "../wailsjs/go/main/App";
import {MediaListSort} from "./anilist/types/AniListTypes";
import type {AniListCurrentUserWatchList} from "./anilist/types/AniListCurrentUserWatchListType"
@@ -51,38 +52,41 @@
const size = "xl"
onMount(async () => {
await CheckIfAniListLoggedIn().then(result => {
if (result) {
GetAniListLoggedInUser().then(result => {
aniListUser.set(result)
await CheckIfAniListLoggedIn().then(loggedIn => {
if (loggedIn) {
GetAniListLoggedInUser().then(user => {
aniListUser.set(user)
if (isAniListPrimary) {
GetAniListUserWatchingList(page, perPage, MediaListSort.UpdatedTimeDesc).then((result) => {
aniListWatchlist.set(result)
aniListLoggedIn.set(true)
GetAniListUserWatchingList(page, perPage, MediaListSort.UpdatedTimeDesc).then((watchList) => {
aniListWatchlist.set(watchList)
aniListLoggedIn.set(loggedIn)
})
} else {
aniListLoggedIn.set(result)
aniListLoggedIn.set(loggedIn)
}
})
}
})
await CheckIfMyAnimeListLoggedIn().then(result => {
if (result) {
GetMyAnimeListLoggedInUser().then(result => {
malUser.set(result)
malLoggedIn.set(result)
await CheckIfMyAnimeListLoggedIn().then(loggedIn => {
if (loggedIn) {
GetMyAnimeListLoggedInUser().then(user => {
malUser.set(user)
GetMyAnimeList(1000).then(watchList => {
malWatchList.set(watchList)
malLoggedIn.set(loggedIn)
})
})
}
})
await CheckIfSimklLoggedIn().then(result => {
if (result) {
GetSimklLoggedInUser().then(result => {
simklUser.set(result)
await CheckIfSimklLoggedIn().then(loggedIn => {
if (loggedIn) {
GetSimklLoggedInUser().then(user => {
simklUser.set(user)
SimklGetUserWatchlist().then(result => {
simklWatchList.set(result)
simklLoggedIn.set(result)
simklLoggedIn.set(loggedIn)
})
})
}