Skip to content

Commit

Permalink
/s /b
Browse files Browse the repository at this point in the history
  • Loading branch information
arily committed Jul 4, 2023
1 parent 91a5b7d commit 0ddb152
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/pages/b/[id].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script setup lang="ts" async>
const { id } = useRoute().params
if (!id || Array.isArray(id)) {
createError('please provide id')
}
const client = useNuxtApp()
const bm = await client.$client.map.beatmap.query({ id: id as string })
navigateTo({
name: 'beatmapset-id',
params: {
id: bm.beatmapset.id,
},
query: {
beatmap: bm.md5,
mode: bm.mode,
},
})
definePageMeta({
render() {},
})
</script>
3 changes: 2 additions & 1 deletion src/pages/beatmapset/[id].vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { BeatmapSource } from '~/def/beatmap'
import { Mode } from '~/def'
import type { AppScoresRankingSystemSwitcher } from '#components'
import type { Label } from '~/composables/useLinks'
Expand Down Expand Up @@ -254,7 +255,7 @@ async function update() {
Source | ID
</dt>
<dd class="stripe-even flex gap-1 items-center">
{{ beatmapset.source }} | {{ selectedMap.foreignId }}
{{ BeatmapSource[beatmapset.source] }} | {{ selectedMap.foreignId }}
</dd>
</div>
<div class="stripe-odd">
Expand Down
6 changes: 6 additions & 0 deletions src/server/trpc/routers/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ export const router = _router({
}
return returnValue
}),
beatmap: p.input(z.object({
id: string().trim(),
})).query(async ({ input }) => {
const bm = await map.getBeatmap({ id: MapProvider.stringToId(input.id) })
return mapId(bm, MapProvider.idToString, ['id', 'foreignId'])
}),
})

0 comments on commit 0ddb152

Please sign in to comment.