fix: streamline cookie import and improve error handling in logIn function
This commit is contained in:
parent
d35951657a
commit
2492b98c20
1 changed files with 19 additions and 21 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { deleteCookie, getCookies, type OptionsType } from "cookies-next";
|
import { deleteCookie, type OptionsType, setCookie } from "cookies-next";
|
||||||
import { setCookie } from "cookies-next/server";
|
|
||||||
import { add } from "date-fns";
|
import { add } from "date-fns";
|
||||||
import { env } from "~/env.mjs";
|
import { env } from "~/env.mjs";
|
||||||
import type { UsersId } from "~/schemas/public/Users";
|
import type { UsersId } from "~/schemas/public/Users";
|
||||||
|
|
@ -172,7 +171,6 @@ export const logIn = async ({
|
||||||
message: `Errore durante l'impostazione dei cookies: ${(cookieError as Error).message}`,
|
message: `Errore durante l'impostazione dei cookies: ${(cookieError as Error).message}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Login error:", e);
|
console.error("Login error:", e);
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue