Fix broken appsRouter (#8719)
This commit is contained in:
1 parent
bc38b3bc55
commit
a2e2b0ed34
2 files changed
+7
-3
No files matched your search
@@ -0,0 +1,4 @@
|
|||||||
|
import { createNextApiHandler } from "@calcom/trpc/server/createNextApiHandler";
|
||||||
|
import { appsRouter } from "@calcom/trpc/server/routers/viewer/apps/_router";
|
||||||
|
|
||||||
|
export default createNextApiHandler(appsRouter);
|
||||||
@@ -37,6 +37,7 @@ const ENDPOINTS = [
|
|||||||
"viewer",
|
"viewer",
|
||||||
"webhook",
|
"webhook",
|
||||||
"workflows",
|
"workflows",
|
||||||
|
"appsRouter",
|
||||||
] as const;
|
] as const;
|
||||||
export type Endpoint = (typeof ENDPOINTS)[number];
|
export type Endpoint = (typeof ENDPOINTS)[number];
|
||||||
|
|
||||||
@@ -51,15 +52,14 @@ const resolveEndpoint = (links: any) => {
|
|||||||
return (ctx: any) => {
|
return (ctx: any) => {
|
||||||
const parts = ctx.op.path.split(".");
|
const parts = ctx.op.path.split(".");
|
||||||
let endpoint;
|
let endpoint;
|
||||||
let path = '';
|
let path = "";
|
||||||
if (parts.length == 2) {
|
if (parts.length == 2) {
|
||||||
endpoint = parts[0] as keyof typeof links;
|
endpoint = parts[0] as keyof typeof links;
|
||||||
path = parts[1];
|
path = parts[1];
|
||||||
} else {
|
} else {
|
||||||
endpoint = parts[1] as keyof typeof links;
|
endpoint = parts[1] as keyof typeof links;
|
||||||
path = parts.splice(2, parts.length - 2).join('.');
|
path = parts.splice(2, parts.length - 2).join(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
return links[endpoint]({ ...ctx, op: { ...ctx.op, path } });
|
return links[endpoint]({ ...ctx, op: { ...ctx.op, path } });
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user