diff options
| author | Fuwn <[email protected]> | 2023-12-30 21:29:33 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-12-30 21:29:33 -0800 |
| commit | 1de5b2a41cba2e5bd3631b9a34bbd6c091918b9b (patch) | |
| tree | e59c53e78dd94b9711fbf59aa5c7173159b04a16 /src/lib/Tools | |
| parent | fix(wrapped): image size for flex (diff) | |
| download | due.moe-1de5b2a41cba2e5bd3631b9a34bbd6c091918b9b.tar.xz due.moe-1de5b2a41cba2e5bd3631b9a34bbd6c091918b9b.zip | |
feat(tools): add follow fix base
Diffstat (limited to 'src/lib/Tools')
| -rw-r--r-- | src/lib/Tools/FollowFix.svelte | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/lib/Tools/FollowFix.svelte b/src/lib/Tools/FollowFix.svelte new file mode 100644 index 00000000..de7a7863 --- /dev/null +++ b/src/lib/Tools/FollowFix.svelte @@ -0,0 +1,50 @@ +<script lang="ts"> + import { toggleFollow } from '$lib/AniList/follow'; + import type { AniListAuthorisation } from '$lib/AniList/identity'; + + export let user: AniListAuthorisation; + + let input = ''; + let submit = ''; +</script> + +{#if user === undefined} + Please log in to view this page. +{:else} + <p> + <input + type="text" + minlength="1" + placeholder="Username" + bind:value={input} + on:keypress={(e) => { + if (e.key === 'Enter') { + submit = input; + + // eslint-disable-next-line no-undef + umami.track('Fix Follow'); + } + }} + /> + <a href={'#'} on:click={() => (submit = input)}> + Toggle follow for {input.length === 0 ? '...' : input} + </a> + </p> + + {#if submit.length > 0} + {#await toggleFollow(user, submit)} + Toggling follow ... + {:then response} + <p> + Successfully toggled follow for {submit}. + + {submit} + {response.isFollower ? 'is' : 'is not'} following you, {response.isFollowing + ? 'but' + : 'and'} you {response.isFollowing ? 'are' : 'are not'} following them. + </p> + {:catch} + <p>Failed to toggle follow for {submit}.</p> + {/await} + {/if} +{/if} |