diff options
| author | Fuwn <[email protected]> | 2024-09-28 20:34:49 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-09-28 20:34:49 -0700 |
| commit | 012b729e93af661f2eccc2a170404eb6da45f9c7 (patch) | |
| tree | 126a8226301c6a8dbb2b0d599c9053587758a0bf /src | |
| parent | feat(user): move profile page badges to graphql (diff) | |
| download | due.moe-012b729e93af661f2eccc2a170404eb6da45f9c7.tar.xz due.moe-012b729e93af661f2eccc2a170404eb6da45f9c7.zip | |
chore(npm): fix graphql builder
Diffstat (limited to 'src')
| -rw-r--r-- | src/graphql/user/resolvers.ts | 16 | ||||
| -rw-r--r-- | src/routes/user/[user]/+page.gql | 12 | ||||
| -rw-r--r-- | src/routes/user/[user]/+page.ts | 32 |
3 files changed, 30 insertions, 30 deletions
diff --git a/src/graphql/user/resolvers.ts b/src/graphql/user/resolvers.ts index a18358be..af71d384 100644 --- a/src/graphql/user/resolvers.ts +++ b/src/graphql/user/resolvers.ts @@ -3,12 +3,12 @@ import type { WithIndex } from '../$types'; import type { Resolvers, Badge } from './$types'; export const resolvers: WithIndex<Resolvers> = { - Query: { - User: async (_, args /* , _context */) => { - return { - id: args.id, - badges: await getUserBadges(args.id) as Badge[] - } - } - } + Query: { + User: async (_, args /* , _context */) => { + return { + id: args.id, + badges: (await getUserBadges(args.id)) as Badge[] + }; + } + } }; diff --git a/src/routes/user/[user]/+page.gql b/src/routes/user/[user]/+page.gql index 182969e2..a0ca87c1 100644 --- a/src/routes/user/[user]/+page.gql +++ b/src/routes/user/[user]/+page.gql @@ -1,7 +1,7 @@ query Profile($id: Int!) { - User(id: $id) { - badges { - id - } - } -}
\ No newline at end of file + User(id: $id) { + badges { + id + } + } +} diff --git a/src/routes/user/[user]/+page.ts b/src/routes/user/[user]/+page.ts index 9d498404..c84caafb 100644 --- a/src/routes/user/[user]/+page.ts +++ b/src/routes/user/[user]/+page.ts @@ -1,19 +1,19 @@ -import { load_Profile } from "$houdini" -import { user } from "$lib/Data/AniList/user" -import type { LoadEvent } from "@sveltejs/kit" +import { load_Profile } from '$houdini'; +import { user } from '$lib/Data/AniList/user'; +import type { LoadEvent } from '@sveltejs/kit'; export const load = async (event: LoadEvent) => { - const username = event.params.user as string - const userData = (await - user(username, /^\d+$/.test(username))) + const username = event.params.user as string; + const userData = await user(username, /^\d+$/.test(username)); - return { - ...(await load_Profile({ - event, variables: { - id: userData.id, - } - })), - username, - userData - } -}
\ No newline at end of file + return { + ...(await load_Profile({ + event, + variables: { + id: userData.id + } + })), + username, + userData + }; +}; |