-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: main page featured levels display
- Loading branch information
1 parent
7e9454c
commit 264ccc4
Showing
6 changed files
with
55 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { api, type APILevel } from '~/lib' | ||
import type { PageLoad } from './$types' | ||
import type { SearchQuery } from '@adofai-gg/query-types' | ||
import type { ListResponse } from '~/types' | ||
import { error } from '@sveltejs/kit' | ||
|
||
export const load: PageLoad = async ({ fetch }) => { | ||
const featuredRes = await fetch(api.forum('levels/search'), { | ||
body: JSON.stringify({ | ||
skip: 0, | ||
take: 5, | ||
query: { | ||
sort: [ | ||
// { | ||
// direction: 'desc', | ||
// objective: 'recent' | ||
// } | ||
], | ||
filter: { | ||
op: 'eq', | ||
key: 'quality', | ||
value: 'FEATURED' | ||
} | ||
} satisfies SearchQuery | ||
}), | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/json' } | ||
}) | ||
|
||
if (!featuredRes.ok) return error(500, 'failed to fetch featured levels') | ||
|
||
const featured = (await featuredRes.json()) as ListResponse<APILevel> | ||
|
||
return { featured } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters