... neon pls
This commit is contained in:
parent
01ab0a43ae
commit
a2481b1e33
2 changed files with 2 additions and 26 deletions
|
@ -8,8 +8,9 @@ generator client {
|
|||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
provider = "mysql"
|
||||
url = env("DATABASE_URL")
|
||||
relationMode = "prisma"
|
||||
}
|
||||
|
||||
model Account {
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
import Ably from "ably/promises";
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { env } from "~/env.mjs";
|
||||
import { getServerSession } from "next-auth/next";
|
||||
import { authOptions } from "../auth";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
) {
|
||||
const session = await getServerSession(req, res, authOptions);
|
||||
|
||||
if (session) {
|
||||
// Signed in
|
||||
const client = new Ably.Realtime(env.ABLY_PRIVATE_KEY);
|
||||
|
||||
const tokenRequestData = await client.auth.createTokenRequest({
|
||||
clientId: session.user.id,
|
||||
});
|
||||
res.status(200).json(tokenRequestData);
|
||||
} else {
|
||||
// Not Signed in
|
||||
res.status(401);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue