fix: improve role assignment logic and permission handling in dashboard components

This commit is contained in:
2025-10-27 08:41:53 -03:00
parent 2c2b792b4a
commit 6bfc0c2ced
19 changed files with 2105 additions and 118 deletions

View File

@@ -6,7 +6,9 @@ import { query } from "./_generated/server";
import { betterAuth } from "better-auth";
import schema from "./betterAuth/schema";
const siteUrl = process.env.SITE_URL!;
// Configurações de ambiente para produção
const siteUrl = process.env.SITE_URL || process.env.CONVEX_SITE_URL || "http://localhost:5173";
const authSecret = process.env.BETTER_AUTH_SECRET;
// The component client has methods needed for integrating Convex with Better Auth,
// as well as helper methods for general use.
@@ -21,6 +23,8 @@ export const createAuth = (
{ optionsOnly } = { optionsOnly: false }
) => {
return betterAuth({
// Secret para criptografia de tokens - OBRIGATÓRIO em produção
secret: authSecret,
// disable logging when createAuth is called just to generate options.
// this is not required, but there's a lot of noise in logs without it.
logger: {