This commit is contained in:
bootunloader
2024-09-19 13:39:22 +03:00
parent 0fb8ba7ff4
commit 1466a45105

View File

@@ -49,6 +49,7 @@ export const apiAuthRouter = createTRPCRouter({
)
.mutation(async ({ input }) => {
console.log("[=] Getting new session... ", input);
try {
const { captchaId, captchaAnswer } = input;
let { userId, userType, password } =
await dbApiUser.getRandomDistributor();
@@ -82,6 +83,13 @@ export const apiAuthRouter = createTRPCRouter({
}
await setSessionToRedis(token.message, input.userId ?? "");
return { success: true, errors: [] as ServerError };
} catch (err) {
console.log(err);
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
message: "Error getting new session.",
});
}
}),
isApiSessionValid: protectedProcedure