WIP changes

This commit is contained in:
daniel31x13
2023-11-02 01:52:49 -04:00
parent b1b0d98eb2
commit b458fad567
20 changed files with 358 additions and 43 deletions
+21
View File
@@ -0,0 +1,21 @@
import { NextApiRequest } from "next";
import { getToken } from "next-auth/jwt";
type Props = {
req: NextApiRequest;
};
export default async function authenticateUser({ req }: Props) {
const token = await getToken({ req });
if (!token?.id) {
return { response: "You must be logged in.", status: 401 };
} else if (token.isSubscriber === false)
return {
response:
"You are not a subscriber, feel free to reach out to us at support@linkwarden.app in case of any issues.",
status: 401,
};
return token;
}