shu
shu
Explore posts from servers
TTCTheo's Typesafe Cult
Created by shu on 5/20/2023 in #questions
Error when deploying T3-Turbo on vercel (using yarn)
5 replies
TTCTheo's Typesafe Cult
Created by shu on 5/20/2023 in #questions
Error when deploying T3-Turbo on vercel (using yarn)
Made pnpm repo as well and same issue
5 replies
TTCTheo's Typesafe Cult
Created by shu on 5/20/2023 in #questions
Error when deploying T3-Turbo on vercel (using yarn)
5 replies
TTCTheo's Typesafe Cult
Created by shu on 5/18/2023 in #questions
tRPC losing types on t3-turbo
11 replies
TTCTheo's Typesafe Cult
Created by shu on 5/18/2023 in #questions
tRPC losing types on t3-turbo
Just checked it out, both workspace and global ts version is the same (5.0.4), tried using the workspace version and restarting tsserver and vscode but its still the same...
11 replies
TTCTheo's Typesafe Cult
Created by shu on 5/18/2023 in #questions
tRPC losing types on t3-turbo
I did get a notification from vscode asking about the typescript version, that might be something...i tried restarting the TS server multiple times, and even restarting vscode altogether did not change anything
11 replies
TTCTheo's Typesafe Cult
Created by shu on 5/18/2023 in #questions
tRPC losing types on t3-turbo
auth router
import bcrypt from "bcryptjs";
import { z } from "zod";

import { createTRPCRouter, protectedProcedure, publicProcedure } from "../trpc";

export const authRouter = createTRPCRouter({
getSession: publicProcedure.query(({ ctx }) => {
return ctx.session;
}),

register: publicProcedure.input(z.object({ email: z.string(), password: z.string() })).mutation(async ({ ctx, input }) => {
const user = await ctx.prisma.user.findUnique({ where: { email: input.email } });

if (user) {
return null;
}

const salt = bcrypt.genSaltSync(10);
const hashedPassword = bcrypt.hashSync(input.password, salt);

return ctx.prisma.user.create({ data: { email: input.email, password: hashedPassword } });
}),

authorize: publicProcedure.input(z.object({ email: z.string(), password: z.string() })).mutation(async ({ ctx, input }) => {
const user: { email: string, password: string} | null = await ctx.prisma.user.findUnique({ where: { email: input.email } });

if (!user) {
return null;
}

const auth = bcrypt.compareSync(input.password, user.password);

if (auth) {
return user;
} else {
return null;
}
}),
});
import bcrypt from "bcryptjs";
import { z } from "zod";

import { createTRPCRouter, protectedProcedure, publicProcedure } from "../trpc";

export const authRouter = createTRPCRouter({
getSession: publicProcedure.query(({ ctx }) => {
return ctx.session;
}),

register: publicProcedure.input(z.object({ email: z.string(), password: z.string() })).mutation(async ({ ctx, input }) => {
const user = await ctx.prisma.user.findUnique({ where: { email: input.email } });

if (user) {
return null;
}

const salt = bcrypt.genSaltSync(10);
const hashedPassword = bcrypt.hashSync(input.password, salt);

return ctx.prisma.user.create({ data: { email: input.email, password: hashedPassword } });
}),

authorize: publicProcedure.input(z.object({ email: z.string(), password: z.string() })).mutation(async ({ ctx, input }) => {
const user: { email: string, password: string} | null = await ctx.prisma.user.findUnique({ where: { email: input.email } });

if (!user) {
return null;
}

const auth = bcrypt.compareSync(input.password, user.password);

if (auth) {
return user;
} else {
return null;
}
}),
});
11 replies
TTCTheo's Typesafe Cult
Created by shu on 5/18/2023 in #questions
tRPC losing types on t3-turbo
11 replies
TTCTheo's Typesafe Cult
Created by shu on 5/18/2023 in #questions
tRPC losing types on t3-turbo
in nextjs
11 replies
TTCTheo's Typesafe Cult
Created by shu on 5/18/2023 in #questions
tRPC losing types on t3-turbo
11 replies
TTCTheo's Typesafe Cult
Created by shu on 5/18/2023 in #questions
tRPC losing types on t3-turbo
in expo
11 replies
TTCTheo's Typesafe Cult
Created by shu on 4/30/2023 in #questions
why do i keep getting errors like errors like this on t3 turbo when trying to install packages
sorry for the late reply but yes
3 replies
TTCTheo's Typesafe Cult
Created by shu on 4/8/2023 in #questions
Expo interactive mode on turborepo
Ohh thanks for the help, thanks for the template as well, clerk is cool :)
12 replies
TTCTheo's Typesafe Cult
Created by shu on 12/24/2022 in #questions
How to return multiple prisma calls with trpc
now i feel stupid xD
5 replies
TTCTheo's Typesafe Cult
Created by shu on 12/24/2022 in #questions
How to return multiple prisma calls with trpc
thanks!! it worked
5 replies
TTCTheo's Typesafe Cult
Created by shu on 12/22/2022 in #questions
How to add more keys to session with next auth
thank you, i figured it out!
4 replies
TTCTheo's Typesafe Cult
Created by shu on 12/22/2022 in #questions
How to add more keys to session with next auth
do u perhaps have a code base which uses this technique that i could reference? would be big help. even if not, thank you for the solution.
4 replies