oscklmO
Convex Community2y ago
19 replies
oscklm

Unsure about right pattern when following zen of convex for actions

I'm trying to follow the concepts from the zen of convex. In this case i wanna create a new user from the client.

I go ahead and make a mutation, that i can call from the client, like this example below:
export const createUser = internalMutation({
  args: {
    username: v.string(),
    password: v.string(),
    email: v.optional(v.string()),
  },
  handler: async (ctx, { username, password, email }) => {

    // Do we create the user already here?? we dont have hashed password yet

    // Run action that will schedule our action handling hashing the password etc.
    // ctx.scheduler.runAfter(...);
  },
});


Am i on the wrong path here, i'm assuming it's best to create my hashed password using a action running on the server, but finding it a bit hard to follow zen of convex here.
Was this page helpful?