fix billing and 2fa admin
Build & Push / Pipeline Tests (push) Failing after 1m58s
Build & Push / Build & Push Docker Image (push) Has been skipped
Test / Type Check (all packages) (push) Successful in 58s
Test / API Unit Tests (push) Successful in 1m9s
Test / Homepage Unit Tests (push) Successful in 46s
Test / Carplace Unit Tests (push) Successful in 43s
Test / Admin Unit Tests (push) Successful in 41s
Test / Dashboard Unit Tests (push) Successful in 45s
Test / API Integration Tests (push) Failing after 1m9s

This commit is contained in:
root
2026-08-10 22:35:55 -04:00
parent 10ca76fc1e
commit 5f06256271
73 changed files with 8803 additions and 570 deletions
+25 -5
View File
@@ -15,11 +15,19 @@ function shouldUseDashboardProxy(configuredApiBase?: string): boolean {
if (!configuredApiBase) return true
if (configuredApiBase.startsWith('/')) return false
const currentHostname = window.location?.hostname
if (!currentHostname || isLocalBrowserHost(currentHostname)) return false
try {
return new URL(configuredApiBase).hostname !== currentHostname
const apiUrl = new URL(configuredApiBase)
const currentOrigin = window.location?.origin
const currentHostname = window.location?.hostname
if (!currentOrigin || !currentHostname) return false
if (isLocalBrowserHost(currentHostname) && isLocalBrowserHost(apiUrl.hostname)) {
return apiUrl.origin !== currentOrigin
}
if (isLocalBrowserHost(currentHostname)) return false
return apiUrl.origin !== currentOrigin
} catch {
return false
}
@@ -87,9 +95,21 @@ export async function apiFetch<T>(path: string, options?: RequestInit): Promise<
}
if (!res.ok) {
const err = new Error(json?.message ?? json?.error ?? `Request failed with status ${res.status}`) as any
const issues = Array.isArray(json?.issues)
? json.issues
.map((issue: any) => {
const path = Array.isArray(issue?.path) && issue.path.length ? `${issue.path.join('.')}: ` : ''
return issue?.message ? `${path}${issue.message}` : null
})
.filter(Boolean)
: []
const message = issues.length
? `${json?.message ?? 'Invalid request'}: ${issues.join('; ')}`
: (json?.message ?? json?.error ?? `Request failed with status ${res.status}`)
const err = new Error(message) as any
err.code = json?.error
err.statusCode = res.status
err.issues = json?.issues
throw err
}