mirror of
https://github.com/sanidhyy/duolingo-clone.git
synced 2025-05-17 13:55:52 +08:00
11 lines
312 B
TypeScript
11 lines
312 B
TypeScript
import { auth } from "@clerk/nextjs";
|
|
|
|
export const getIsAdmin = () => {
|
|
const { userId } = auth();
|
|
const adminIds = process.env.CLERK_ADMIN_IDS.split(", "); // stored in .env.local file as string separated by comma(,) and space( )
|
|
|
|
if (!userId) return false;
|
|
|
|
return adminIds.indexOf(userId) !== -1;
|
|
};
|