2023-03-09 10:05:32 -07:00
|
|
|
<template>
|
2025-08-14 21:48:38 +01:00
|
|
|
<NuxtLayout>
|
|
|
|
|
<ModrinthLoadingIndicator />
|
|
|
|
|
<NotificationPanel />
|
|
|
|
|
<NuxtPage />
|
|
|
|
|
</NuxtLayout>
|
2023-03-09 10:05:32 -07:00
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
2025-08-14 21:48:38 +01:00
|
|
|
import { NotificationPanel, provideNotificationManager } from '@modrinth/ui'
|
2025-08-28 15:11:35 -07:00
|
|
|
import { provideApi } from '@modrinth/ui/src/providers/api.ts'
|
|
|
|
|
import { RestModrinthApi } from '@modrinth/utils'
|
2025-08-13 21:48:52 +01:00
|
|
|
|
2025-08-14 21:48:38 +01:00
|
|
|
import ModrinthLoadingIndicator from '~/components/ui/modrinth-loading-indicator.ts'
|
|
|
|
|
|
|
|
|
|
import { FrontendNotificationManager } from './providers/frontend-notifications.ts'
|
|
|
|
|
|
|
|
|
|
provideNotificationManager(new FrontendNotificationManager())
|
2025-08-28 15:11:35 -07:00
|
|
|
|
|
|
|
|
provideApi(
|
|
|
|
|
new RestModrinthApi((url: string, options?: object) => {
|
|
|
|
|
const match = url.match(/^\/v(\d+)\/(.+)$/)
|
|
|
|
|
|
|
|
|
|
if (match) {
|
|
|
|
|
const apiVersion = Number(match[1])
|
|
|
|
|
const path = match[2]
|
|
|
|
|
|
|
|
|
|
return useBaseFetch(path, {
|
|
|
|
|
...options,
|
|
|
|
|
apiVersion,
|
|
|
|
|
}) as Promise<Response>
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error('Invalid format')
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
)
|
2023-03-09 10:05:32 -07:00
|
|
|
</script>
|