feat(convex): add internal url and remote access fixes
This commit is contained in:
parent
feb31d48c1
commit
da46fa448b
17 changed files with 73 additions and 92 deletions
|
|
@ -4,9 +4,9 @@ import { ConvexHttpClient } from "convex/browser"
|
|||
|
||||
import { api } from "@/convex/_generated/api"
|
||||
import type { Id } from "@/convex/_generated/dataModel"
|
||||
import { env } from "@/lib/env"
|
||||
import { buildXlsxWorkbook } from "@/lib/xlsx"
|
||||
import { REPORT_EXPORT_DEFINITIONS, type ReportExportKey } from "@/lib/report-definitions"
|
||||
import { requireConvexUrl } from "@/server/convex-client"
|
||||
export type { ReportExportKey }
|
||||
|
||||
type ViewerIdentity = {
|
||||
|
|
@ -24,11 +24,7 @@ export type ConvexReportContext = {
|
|||
}
|
||||
|
||||
export async function createConvexContext(identity: ViewerIdentity): Promise<ConvexReportContext> {
|
||||
const convexUrl = env.NEXT_PUBLIC_CONVEX_URL
|
||||
if (!convexUrl) {
|
||||
throw new Error("Convex URL não configurada para exportações")
|
||||
}
|
||||
const client = new ConvexHttpClient(convexUrl)
|
||||
const client = new ConvexHttpClient(requireConvexUrl())
|
||||
const ensuredUser = await client.mutation(api.users.ensureUser, {
|
||||
tenantId: identity.tenantId,
|
||||
name: identity.name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue