Compare commits
3 Commits
0.2.0
...
cd62e6c658
| Author | SHA1 | Date | |
|---|---|---|---|
| cd62e6c658 | |||
| 063c5016f3 | |||
| 5c4caf68e6 |
@@ -308,7 +308,16 @@ func refreshMyAnimeListAuthorizationToken() {
|
|||||||
|
|
||||||
func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser {
|
func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser {
|
||||||
a.MyAnimeListLogin()
|
a.MyAnimeListLogin()
|
||||||
|
user := createUser()
|
||||||
|
if user.Name == "" {
|
||||||
|
refreshMyAnimeListAuthorizationToken()
|
||||||
|
user = createUser()
|
||||||
|
}
|
||||||
|
|
||||||
|
return user
|
||||||
|
}
|
||||||
|
|
||||||
|
func createUser() MyAnimeListUser {
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
|
|
||||||
req, _ := http.NewRequest("GET", "https://api.myanimelist.net/v2/users/@me?fields=anime_statistics", nil)
|
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
|
return user
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) LogoutMyAnimeList() string {
|
func (a *App) LogoutMyAnimeList() string {
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {
|
import {
|
||||||
aniListAnime,
|
aniListAnime,
|
||||||
|
aniListLoggedIn,
|
||||||
GetAnimeSingleItem,
|
GetAnimeSingleItem,
|
||||||
|
malLoggedIn,
|
||||||
|
simklLoggedIn,
|
||||||
} from "./helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
} from "./helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
||||||
import {onMount} from "svelte";
|
import {onMount} from "svelte";
|
||||||
import Router from "svelte-spa-router"
|
import Router from "svelte-spa-router"
|
||||||
@@ -16,9 +19,17 @@
|
|||||||
import {AniListGetSingleAnimeDefaultData} from "./helperDefaults/AniListGetSingleAnime";
|
import {AniListGetSingleAnimeDefaultData} from "./helperDefaults/AniListGetSingleAnime";
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await CheckIfAniListLoggedInAndLoadWatchList()
|
let isAniListLoggedIn: boolean
|
||||||
await CheckIfMALLoggedInAndSetUser()
|
let isMALLoggedIn: boolean
|
||||||
await CheckIfSimklLoggedInAndSetUser()
|
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>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
import { AddAnimeServiceToTable } from "../helperModules/AddAnimeServiceToTable.svelte";
|
import { AddAnimeServiceToTable } from "../helperModules/AddAnimeServiceToTable.svelte";
|
||||||
import { CheckIfAniListLoggedInAndLoadWatchList } from "../helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
|
import { CheckIfAniListLoggedInAndLoadWatchList } from "../helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
|
||||||
import Datepicker from "./Datepicker.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})/;
|
const re = /^([0-9]{4})-([0-9]{2})-([0-9]{2})/;
|
||||||
|
|
||||||
let isAniListLoggedIn: boolean;
|
let isAniListLoggedIn: boolean;
|
||||||
@@ -213,9 +213,6 @@
|
|||||||
};
|
};
|
||||||
await AniListUpdateEntry(body).then(
|
await AniListUpdateEntry(body).then(
|
||||||
(value: AniListGetSingleAnime) => {
|
(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 =
|
value.data.MediaList.media.tags =
|
||||||
currentAniListAnime.data.MediaList.media.tags;
|
currentAniListAnime.data.MediaList.media.tags;
|
||||||
aniListAnime.update((newValue) => {
|
aniListAnime.update((newValue) => {
|
||||||
@@ -834,9 +831,13 @@
|
|||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
{#each currentAniListAnime.data.MediaList.media.tags as tag}
|
{#each currentAniListAnime.data.MediaList.media.tags as tag}
|
||||||
<div>
|
<div>
|
||||||
<Badge large border color="blue" class="m-1 w-40"
|
<Badge large border color="blue" class="m-1 w-52">
|
||||||
>{tag.name}</Badge
|
<div>
|
||||||
>
|
{tag.name} -
|
||||||
|
<span class="text-xs">{tag.rank}%</span>
|
||||||
|
</div>
|
||||||
|
</Badge>
|
||||||
|
<Tooltip>{tag.description}</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,6 +12,6 @@
|
|||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
"productName": "AniTrack",
|
"productName": "AniTrack",
|
||||||
"productVersion": "0.2.0"
|
"productVersion": "0.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user