refactor: rename endpoint option

This commit is contained in:
Robert Soriano
2022-06-12 23:17:13 -07:00
parent 333539569c
commit c77eb68f5d
2 changed files with 4 additions and 4 deletions

View File

@@ -61,7 +61,7 @@ export default defineNuxtModule<ModuleOptions>({
export default createTRPCHandler({
...functions,
trpcURL: '${finalConfig.trpcURL}'
endpoint: '${finalConfig.trpcURL}'
})
`
},

View File

@@ -42,13 +42,13 @@ export function createTRPCHandler<Router extends AnyRouter>({
createContext,
responseMeta,
onError,
trpcURL,
endpoint,
}: {
router: Router
createContext?: CreateContextFn<Router>
responseMeta?: ResponseMetaFn<Router>
onError?: OnErrorFn<Router>
trpcURL: string
endpoint: string
}) {
return defineEventHandler(async (event) => {
const {
@@ -66,7 +66,7 @@ export function createTRPCHandler<Router extends AnyRouter>({
body: isMethod(event, 'GET') ? null : await useBody(event),
query: $url.searchParams,
},
path: $url.pathname.substring(trpcURL.length + 1),
path: $url.pathname.substring(endpoint.length + 1),
createContext: async () => createContext?.(event),
responseMeta,
onError: (o) => {