Compare commits
5 Commits
0.1.9
...
cd62e6c658
| Author | SHA1 | Date | |
|---|---|---|---|
| cd62e6c658 | |||
| 063c5016f3 | |||
| 5c4caf68e6 | |||
| c10e853564 | |||
| cd043d093f |
@@ -308,7 +308,16 @@ func refreshMyAnimeListAuthorizationToken() {
|
||||
|
||||
func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser {
|
||||
a.MyAnimeListLogin()
|
||||
user := createUser()
|
||||
if user.Name == "" {
|
||||
refreshMyAnimeListAuthorizationToken()
|
||||
user = createUser()
|
||||
}
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
func createUser() MyAnimeListUser {
|
||||
client := &http.Client{}
|
||||
|
||||
req, _ := http.NewRequest("GET", "https://api.myanimelist.net/v2/users/@me?fields=anime_statistics", nil)
|
||||
@@ -335,6 +344,7 @@ func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser {
|
||||
}
|
||||
|
||||
return user
|
||||
|
||||
}
|
||||
|
||||
func (a *App) LogoutMyAnimeList() string {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
aniListAnime,
|
||||
aniListLoggedIn,
|
||||
GetAnimeSingleItem,
|
||||
malLoggedIn,
|
||||
simklLoggedIn,
|
||||
} from "./helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
||||
import {onMount} from "svelte";
|
||||
import Router from "svelte-spa-router"
|
||||
@@ -16,9 +19,17 @@
|
||||
import {AniListGetSingleAnimeDefaultData} from "./helperDefaults/AniListGetSingleAnime";
|
||||
|
||||
onMount(async () => {
|
||||
await CheckIfAniListLoggedInAndLoadWatchList()
|
||||
await CheckIfMALLoggedInAndSetUser()
|
||||
await CheckIfSimklLoggedInAndSetUser()
|
||||
let isAniListLoggedIn: boolean
|
||||
let isMALLoggedIn: boolean
|
||||
let isSimklLoggedIn: boolean
|
||||
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
|
||||
malLoggedIn.subscribe((value) => isMALLoggedIn = value)
|
||||
simklLoggedIn.subscribe((value) => isSimklLoggedIn = value)
|
||||
|
||||
console.log(isAniListLoggedIn)
|
||||
!isAniListLoggedIn && await CheckIfAniListLoggedInAndLoadWatchList()
|
||||
!isMALLoggedIn && await CheckIfMALLoggedInAndSetUser()
|
||||
!isSimklLoggedIn && await CheckIfSimklLoggedInAndSetUser()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
import { AddAnimeServiceToTable } from "../helperModules/AddAnimeServiceToTable.svelte";
|
||||
import { CheckIfAniListLoggedInAndLoadWatchList } from "../helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
|
||||
import Datepicker from "./Datepicker.svelte";
|
||||
import { Badge } from "flowbite-svelte";
|
||||
import {Badge, Tooltip} from "flowbite-svelte";
|
||||
const re = /^([0-9]{4})-([0-9]{2})-([0-9]{2})/;
|
||||
|
||||
let isAniListLoggedIn: boolean;
|
||||
@@ -213,9 +213,8 @@
|
||||
};
|
||||
await AniListUpdateEntry(body).then(
|
||||
(value: AniListGetSingleAnime) => {
|
||||
/* TODO in future when you inevitably add tags to typescript, until Anilist fixes the api bug
|
||||
where tags break the SaveMediaListEntry return, you'll want to use this delete line
|
||||
delete value.data.MediaList.media.tags */
|
||||
value.data.MediaList.media.tags =
|
||||
currentAniListAnime.data.MediaList.media.tags;
|
||||
aniListAnime.update((newValue) => {
|
||||
newValue = value;
|
||||
return newValue;
|
||||
@@ -445,7 +444,6 @@
|
||||
currentAniListAnime.data.MediaList.media.nextAiringEpisode.episode -
|
||||
1;
|
||||
}
|
||||
console.log(currentAniListAnime.data.MediaList.media);
|
||||
</script>
|
||||
|
||||
<form on:submit|preventDefault={handleSubmit} class="container pt-3 pb-10">
|
||||
@@ -833,9 +831,13 @@
|
||||
<div class="mt-2">
|
||||
{#each currentAniListAnime.data.MediaList.media.tags as tag}
|
||||
<div>
|
||||
<Badge large border color="blue" class="m-1 w-40"
|
||||
>{tag.name}</Badge
|
||||
>
|
||||
<Badge large border color="blue" class="m-1 w-52">
|
||||
<div>
|
||||
{tag.name} -
|
||||
<span class="text-xs">{tag.rank}%</span>
|
||||
</div>
|
||||
</Badge>
|
||||
<Tooltip>{tag.description}</Tooltip>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
},
|
||||
"info": {
|
||||
"productName": "AniTrack",
|
||||
"productVersion": "0.1.9"
|
||||
"productVersion": "0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user