added ability to get Anilist Item, Search and JWT token
This commit is contained in:
@ -1,22 +1,68 @@
|
||||
<script lang="ts">
|
||||
import logo from './assets/images/logo-universal.png'
|
||||
import {Greet} from '../wailsjs/go/main/App.js'
|
||||
import {AniListLogin, AniListSearch, GetAniListItem} from "../wailsjs/go/main/App";
|
||||
import type {AniListItem, AniSearchList} from "./AniListTypes";
|
||||
|
||||
let resultText: string = "Please enter your name below 👇"
|
||||
let name: string
|
||||
let aniId = "157371"
|
||||
let aniSearch = ""
|
||||
let aniListItem: AniListItem
|
||||
let aniListSearch: AniSearchList
|
||||
let aniListLoggedIn = false
|
||||
|
||||
function greet(): void {
|
||||
Greet(name).then(result => resultText = result)
|
||||
}
|
||||
|
||||
function getAniListitem(): void {
|
||||
GetAniListItem(Number(aniId)).then(result => aniListItem = result)
|
||||
}
|
||||
|
||||
function runAniListSearch(): void {
|
||||
AniListSearch(aniSearch).then(result => aniListSearch = result)
|
||||
}
|
||||
|
||||
function loginToAniList(): void {
|
||||
AniListLogin().then(() => aniListLoggedIn = true)
|
||||
}
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<img alt="Wails logo" id="logo" src="{logo}">
|
||||
<div class="result" id="result">{resultText}</div>
|
||||
<div class="input-box" id="input">
|
||||
<input autocomplete="off" bind:value={name} class="input" id="name" type="text"/>
|
||||
<button class="btn" on:click={greet}>Greet</button>
|
||||
<img alt="Wails logo" id="logo" src="{aniListItem === undefined ? logo : aniListItem.data.Media.coverImage.extraLarge}">
|
||||
<!-- <div class="result" id="result">{resultText}</div>-->
|
||||
<!-- <div class="input-box" id="input">-->
|
||||
<!-- <input autocomplete="off" bind:value={name} class="input" id="name" type="text"/>-->
|
||||
<!-- <button class="btn" on:click={greet}>Greet</button>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="result" id="AniTest">{aniListItem !== undefined ? aniListItem.data.Media.title.english : ""}</div>
|
||||
<div class="input-box" id="aniButton">
|
||||
<input autocomplete="off" bind:value={aniId} class="input" id="aniId" type="text"/>
|
||||
<button class="btn" on:click={getAniListitem}>Get AniList Item</button>
|
||||
</div>
|
||||
|
||||
<button class="btn" on:click={loginToAniList}>Login to AniList</button>
|
||||
{#if aniListLoggedIn}
|
||||
<div>You are logged in!</div>
|
||||
{/if}
|
||||
|
||||
<div class="input-box" id="aniSearch">
|
||||
<input autocomplete="off" bind:value={aniSearch} class="input" id="aniSearchInput" type="text"/>
|
||||
<button class="btn" on:click={runAniListSearch}>Search AniList</button>
|
||||
</div>
|
||||
{#if aniListSearch !== undefined}
|
||||
<ul>
|
||||
{#each aniListSearch.data.Page.media as media, index (media.id)}
|
||||
<li>
|
||||
<div>{media.title.english !== null ? media.title.english : media.title.romaji}</div>
|
||||
</li>
|
||||
{:else}
|
||||
<div>No Results Yet...</div>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
</main>
|
||||
|
||||
<style>
|
||||
@ -40,7 +86,7 @@
|
||||
}
|
||||
|
||||
.input-box .btn {
|
||||
width: 60px;
|
||||
/*width: 60px;*/
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
border-radius: 3px;
|
||||
|
Reference in New Issue
Block a user