Skip to content

Conversation

Jaime1108
Copy link
Collaborator

@Jaime1108 Jaime1108 commented Oct 9, 2025

What:

  • Created three standardized next-safe-action clients for handling access control in the file
  • src/lib/ActionClient.ts
    • publicAction for general access
    • protectedAction for authenticated users
    • adminAction for users with admin privileges

Why:
We need Next-Safe-Action initialize

Issue resolved: https://linear.app/acmutsa/issue/LRN-3

Copy link
Collaborator

@joshuasilva414 joshuasilva414 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of redefining the middleware each time, you can actually create adminClient by taking authenticatedClient and chaining on the middleware to check for the admin role

Copy link
Collaborator

@joshuasilva414 joshuasilva414 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something doesn't look quite right about these. They should look a little more similar to this:
export const greetAction = actionClient .inputSchema(inputSchema) .action(async ({ parsedInput: { name } }) => { return { message: Hello, ${name}!, }; });

I know some of this depends on auth, so we can revisit this once that's finished. Also, the next-safe-action package hasn't been installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants