Diogo
Explore posts from serversTTCTheo's Typesafe Cult
•Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
8 replies
TTCTheo's Typesafe Cult
•Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
it only solves the type error, if i build the project it throws an error
8 replies
TTCTheo's Typesafe Cult
•Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
but i am not sure if its the right way to do it
8 replies
TTCTheo's Typesafe Cult
•Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
8 replies
TTCTheo's Typesafe Cult
•Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
authoptions
import { env } from "@/env.mjs";
import { db } from "@/server/db";
import { PrismaAdapter } from "@auth/prisma-adapter";
import {
getServerSession,
type DefaultSession,
type NextAuthOptions,
} from "next-auth";
import GithubProvider from "next-auth/providers/github";
import GoogleProvider from "next-auth/providers/google";
import { redirect } from "next/navigation";
declare module "next-auth" {
interface Session {
user: DefaultSession["user"] & {
id: string;
};
}
}
export type AuthSession = {
session: {
user: {
id: string;
name?: string;
email?: string;
image?: string;
};
} | null;
};
export const authOptions: NextAuthOptions = {
adapter: PrismaAdapter(db),
callbacks: {
session: ({ session, user }) => {
session.user.id = user.id;
return session;
},
},
providers: [
GoogleProvider({
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
}),
GithubProvider({
clientId: env.GITHUB_CLIENT_ID,
clientSecret: env.GITHUB_CLIENT_SECRET,
}),
],
};
export const getUserAuth = async () => {
const session = await getServerSession(authOptions);
return { session } as AuthSession;
};
export const checkAuth = async () => {
const { session } = await getUserAuth();
if (!session) redirect("/api/auth/signin");
};
8 replies
TTCTheo's Typesafe Cult
•Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
Anyone knows how to solve these?
8 replies
TTCTheo's Typesafe Cult
•Created by test_1 on 6/16/2023 in #questions
i want to display amount of comments a post has before fetching all the comments
6 replies
TTCTheo's Typesafe Cult
•Created by test_1 on 6/16/2023 in #questions
i want to display amount of comments a post has before fetching all the comments
the output should look like these if im correct:
6 replies
TTCTheo's Typesafe Cult
•Created by test_1 on 6/16/2023 in #questions
i want to display amount of comments a post has before fetching all the comments
try this:
6 replies
TTCTheo's Typesafe Cult
•Created by hyperzone on 6/16/2023 in #questions
Caching ORM response in Next app dir
could it bc youre using a a const and not a function like in the docs?
4 replies
TTCTheo's Typesafe Cult
•Created by .traevelliath on 6/14/2023 in #questions
Prisma query multiple tables
you want to read this https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries
7 replies
TTCTheo's Typesafe Cult
•Created by .traevelliath on 6/14/2023 in #questions
Prisma query multiple tables
something like this
7 replies
TTCTheo's Typesafe Cult
•Created by .traevelliath on 6/14/2023 in #questions
Prisma query multiple tables
7 replies
TTCTheo's Typesafe Cult
•Created by Ayato on 6/14/2023 in #questions
YouTube Data API
never worked with youtube api
7 replies
TTCTheo's Typesafe Cult
•Created by Ayato on 6/14/2023 in #questions
YouTube Data API
no idea kkkkk
7 replies
TTCTheo's Typesafe Cult
•Created by Ayato on 6/14/2023 in #questions
YouTube Data API
dont forget the api key
7 replies
TTCTheo's Typesafe Cult
•Created by Ayato on 6/14/2023 in #questions
YouTube Data API
try this instead https://www.googleapis.com/youtube/v3/search?part=id,snippet&maxResults=1&type=channel&q=t3dotgg
7 replies
TTCTheo's Typesafe Cult
•Created by Lopen on 6/5/2023 in #questions
drizzle orm is overhyped
showing how fast it is
68 replies
TTCTheo's Typesafe Cult
•Created by Lopen on 6/5/2023 in #questions
drizzle orm is overhyped
he's agreeing width you and showing an example of a query with kysely ( that took 4ms )
68 replies
TTCTheo's Typesafe Cult
•Created by fasm on 5/23/2023 in #questions
Clerk: auth() was called but it looks like you aren't using authMiddleware in your middleware file
Try moving the middleware file outside the src folder
13 replies