fix(auth): make things work

This commit is contained in:
Michael Zetterberg
2024-05-20 09:05:49 +02:00
parent c4912bbb94
commit 476e9f7582
19 changed files with 122 additions and 82 deletions
+6 -2
View File
@@ -2,7 +2,11 @@ import { initTRPC } from "@trpc/server"
import { env } from "@/env/server"
import { badRequestError, unauthorizedError } from "./errors/trpc"
import {
badRequestError,
sessionExpiredError,
unauthorizedError,
} from "./errors/trpc"
import { transformer } from "./transformer"
import type { Meta } from "@/types/trpc/meta"
@@ -35,7 +39,7 @@ export const protectedProcedure = t.procedure.use(async function (opts) {
}
if (session?.error === "RefreshAccessTokenError") {
throw unauthorizedError()
throw sessionExpiredError()
}
if (!session?.user) {