feat: add trpc websocket (#205)
This commit is contained in:
1 parent
9ae99ad06c
commit
4f375cbe6d
14 files changed
+268
-32
No files matched your search
@@ -2,6 +2,7 @@ import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
||||
|
||||
import { appRouter, createTRPCContext } from "@homarr/api";
|
||||
import { auth } from "@homarr/auth";
|
||||
import { logger } from "@homarr/log";
|
||||
|
||||
/**
|
||||
* Configure basic CORS headers
|
||||
@@ -29,8 +30,10 @@ const handler = auth(async (req) => {
|
||||
req,
|
||||
createContext: () =>
|
||||
createTRPCContext({ session: req.auth, headers: req.headers }),
|
||||
onError({ error, path }) {
|
||||
console.error(`>>> tRPC Error on '${path}'`, error);
|
||||
onError({ error, path, type }) {
|
||||
logger.error(
|
||||
`tRPC Error with ${type} on '${path}': (${error.code}) - ${error.message}`,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user