feat: start of cross platform page system (#4731)

* feat: abstract api-client DI into ui package

* feat: cross platform page system

* feat: tanstack as cross platform useAsyncData

* feat: archon servers routes + labrinth billing routes

* fix: dont use partial

* feat: migrate server list page to tanstack + api-client + re-enabled broken features!

* feat: migrate servers manage page to api-client before page system

* feat: migrate manage page to page system

* fix: type issues

* fix: upgrade wrapper bugs

* refactor: move state types into api-client

* feat: disable financial stuff on app frontend

* feat: finalize cross platform page system for now

* fix: lint

* fix: build issues

* feat: remove papaparse

* fix: lint

* fix: interface error

---------

Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
Calum H.
2025-11-14 17:15:09 +00:00
committed by GitHub
parent 26feaf753a
commit 7ccc32675b
79 changed files with 2631 additions and 1259 deletions

View File

@@ -0,0 +1,38 @@
import {
type AbstractFeature,
type AuthConfig,
AuthFeature,
CircuitBreakerFeature,
NuxtCircuitBreakerStorage,
type NuxtClientConfig,
NuxtModrinthClient,
VerboseLoggingFeature,
} from '@modrinth/api-client'
export function createModrinthClient(
auth: { token: string | undefined },
config: { apiBaseUrl: string; archonBaseUrl: string; rateLimitKey?: string },
): NuxtModrinthClient {
const optionalFeatures = [
import.meta.dev ? (new VerboseLoggingFeature() as AbstractFeature) : undefined,
].filter(Boolean) as AbstractFeature[]
const clientConfig: NuxtClientConfig = {
labrinthBaseUrl: config.apiBaseUrl,
archonBaseUrl: config.archonBaseUrl,
rateLimitKey: config.rateLimitKey,
features: [
new AuthFeature({
token: async () => auth.token,
} as AuthConfig),
new CircuitBreakerFeature({
storage: new NuxtCircuitBreakerStorage(),
maxFailures: 3,
resetTimeout: 30000,
}),
...optionalFeatures,
],
}
return new NuxtModrinthClient(clientConfig)
}