added getting MAL watchlist
This commit is contained in:
@ -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)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
import {writable} from 'svelte/store'
|
||||
import type {SimklUser, SimklWatchList} from "./simkl/types/simklTypes";
|
||||
import {type AniListUser, MediaListSort} from "./anilist/types/AniListTypes";
|
||||
import type {MyAnimeListUser} from "./mal/types/MALTypes";
|
||||
import type {MALWatchlist, MyAnimeListUser} from "./mal/types/MALTypes";
|
||||
|
||||
export let aniListAnime: AniListGetSingleAnime
|
||||
export let title = writable("")
|
||||
@ -25,6 +25,7 @@
|
||||
export let aniListUser = writable({} as AniListUser)
|
||||
export let malUser = writable({} as MyAnimeListUser)
|
||||
export let aniListWatchlist = writable({} as AniListCurrentUserWatchList)
|
||||
export let malWatchList = writable({} as MALWatchlist)
|
||||
|
||||
export let watchListPage = writable(1)
|
||||
export let animePerPage = writable(20)
|
||||
|
@ -28,4 +28,38 @@ export interface AnimeStatistics {
|
||||
numEpisodes: number
|
||||
numTimesRewatched: number
|
||||
meanScore: number
|
||||
}
|
||||
}
|
||||
|
||||
export interface MALWatchlist {
|
||||
data: {
|
||||
node: Node
|
||||
listStatus: ListStatus
|
||||
}[]
|
||||
paging: Paging
|
||||
}
|
||||
|
||||
export interface Node {
|
||||
id: number
|
||||
title: string
|
||||
mainPicture: MainPicture
|
||||
}
|
||||
|
||||
export interface MainPicture {
|
||||
medium: string
|
||||
large: string
|
||||
}
|
||||
|
||||
export interface ListStatus {
|
||||
status: string
|
||||
score: number
|
||||
numEpisodesWatched: number
|
||||
isRewatching: boolean
|
||||
updated_at: string
|
||||
startDate: string
|
||||
finishDate: string
|
||||
}
|
||||
|
||||
export interface Paging {
|
||||
previous: string
|
||||
next: string
|
||||
}
|
||||
|
Reference in New Issue
Block a user