diff options
| author | Fuwn <[email protected]> | 2024-01-24 20:43:41 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-01-24 20:43:41 -0800 |
| commit | e80a83cf87eb79be4c2ac016d3c97709d41ee353 (patch) | |
| tree | a59dbf15eca22ae1faab8ac7e377dcc87f1a5420 /src/lib/Tools/ActivityHistory/Tool.svelte | |
| parent | feat(settings): smaller default cover width (diff) | |
| download | due.moe-e80a83cf87eb79be4c2ac016d3c97709d41ee353.tar.xz due.moe-e80a83cf87eb79be4c2ac016d3c97709d41ee353.zip | |
feat(identity): use global store
Diffstat (limited to 'src/lib/Tools/ActivityHistory/Tool.svelte')
| -rw-r--r-- | src/lib/Tools/ActivityHistory/Tool.svelte | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/lib/Tools/ActivityHistory/Tool.svelte b/src/lib/Tools/ActivityHistory/Tool.svelte index 51f2ac82..6728f9c6 100644 --- a/src/lib/Tools/ActivityHistory/Tool.svelte +++ b/src/lib/Tools/ActivityHistory/Tool.svelte @@ -5,11 +5,8 @@ type ActivityHistoryEntry } from '$lib/AniList/activity'; import { onMount } from 'svelte'; - import userIdentity from '$stores/userIdentity'; - import { - userIdentity as getUserIdentity, - type AniListAuthorisation - } from '$lib/AniList/identity'; + import userIdentity from '$stores/identity'; + import type { AniListAuthorisation } from '$lib/AniList/identity'; import { clearAllParameters } from '../../Utility/parameters'; import { domToBlob } from 'modern-screenshot'; import ActivityHistoryGrid from './Grid.svelte'; @@ -18,23 +15,12 @@ export let user: AniListAuthorisation; let activityHistoryData: Promise<ActivityHistoryEntry[]>; - let currentUserIdentity = { - name: '', - id: -1, - avatar: 'https://s4.anilist.co/file/anilistcdn/user/avatar/large/default.png' - }; let generated = false; onMount(async () => { clearAllParameters(); - if (user !== undefined) { - if ($userIdentity === '') userIdentity.set(JSON.stringify(await getUserIdentity(user))); - - currentUserIdentity = JSON.parse($userIdentity); - currentUserIdentity.name = currentUserIdentity.name; - activityHistoryData = activityHistory(currentUserIdentity); - } + if (user !== undefined) activityHistoryData = activityHistory($userIdentity); }); // const incrementDate = (date: Date): Date => { |