aboutsummaryrefslogtreecommitdiff
path: root/src/routes/user/+page.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/user/+page.svelte')
-rw-r--r--src/routes/user/+page.svelte46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/routes/user/+page.svelte b/src/routes/user/+page.svelte
index 3589f073..ee7c69af 100644
--- a/src/routes/user/+page.svelte
+++ b/src/routes/user/+page.svelte
@@ -1,30 +1,30 @@
<script lang="ts">
-import { browser } from '$app/environment';
-import { goto } from '$app/navigation';
-import type { UserIdentity } from '$lib/Data/AniList/identity';
-import { onMount } from 'svelte';
-import { env } from '$env/dynamic/public';
-import HeadTitle from '$lib/Home/HeadTitle.svelte';
-import root from '$lib/Utility/root';
-import { page } from '$app/stores';
-import localforage from 'localforage';
+import { browser } from "$app/environment";
+import { goto } from "$app/navigation";
+import type { UserIdentity } from "$lib/Data/AniList/identity";
+import { onMount } from "svelte";
+import { env } from "$env/dynamic/public";
+import HeadTitle from "$lib/Home/HeadTitle.svelte";
+import root from "$lib/Utility/root";
+import { page } from "$app/stores";
+import localforage from "localforage";
onMount(async () => {
- if (browser) {
- const user = ((await localforage.getItem('identity')) as UserIdentity).name;
+ if (browser) {
+ const user = ((await localforage.getItem("identity")) as UserIdentity).name;
- if (user) {
- if (browser && $page.url.searchParams.get('badges') !== null) {
- goto(root(`/user/${user}/badges`));
- } else {
- goto(root(`/user/${user}`));
- }
- } else {
- goto(
- `https://anilist.co/api/v2/oauth/authorize?client_id=${env.PUBLIC_ANILIST_CLIENT_ID}&redirect_uri=${env.PUBLIC_ANILIST_REDIRECT_URI}&response_type=code`
- );
- }
- }
+ if (user) {
+ if (browser && $page.url.searchParams.get("badges") !== null) {
+ goto(root(`/user/${user}/badges`));
+ } else {
+ goto(root(`/user/${user}`));
+ }
+ } else {
+ goto(
+ `https://anilist.co/api/v2/oauth/authorize?client_id=${env.PUBLIC_ANILIST_CLIENT_ID}&redirect_uri=${env.PUBLIC_ANILIST_REDIRECT_URI}&response_type=code`,
+ );
+ }
+ }
});
</script>