premieroctet / next-admin

▲ Full-featured admin for Next.js and Prisma
https://next-admin.js.org
MIT License
324 stars 19 forks source link

[FEATURE] - Create a Next Admin Client #489

Open cregourd opened 1 week ago

cregourd commented 1 week ago

Summary

To avoid passing the prisma and options twice, to the getNextAdminProps and createHandler functions. Create a function that retrieves these two parameters and returns a pre-initialized version of getNextAdminProps and createHandler. This will prevent people from forgetting to put options in both functions and leading to strange problems.

Basic Example

// nextadmin.ts
export const nextAdmin = initNextAdmin({
  prisma,
 options
}) 
// => {getNextAdminProps, createHandler}

Drawbacks

No response

Unresolved questions

No response