export const authRouter = createTRPCRouter({
login: publicProcedure.input(loginSchema).mutation(async ({ ctx, input }) => {
await sleep(10000); //that was added in to see if the request takes 10s, which it doesn't
const client = ctx.supabase;
const { error, data } = await client.auth.signInWithPassword({
email: input.email,
password: input.password,
});
if (error)
throw new TRPCError({
code: "UNAUTHORIZED",
cause: error,
message: "Not authorized.",
});
return data;
}),
});
export const authRouter = createTRPCRouter({
login: publicProcedure.input(loginSchema).mutation(async ({ ctx, input }) => {
await sleep(10000); //that was added in to see if the request takes 10s, which it doesn't
const client = ctx.supabase;
const { error, data } = await client.auth.signInWithPassword({
email: input.email,
password: input.password,
});
if (error)
throw new TRPCError({
code: "UNAUTHORIZED",
cause: error,
message: "Not authorized.",
});
return data;
}),
});