Feature Request: Setting member Roles with code

I have been looking at the previous posts about this topic and seems there is no direct way to set member roles with code after signing up. This would be useful in sorting out the member list when they sign up.

Do a testing registration on the following example-site, and see if your wished functionality is able to be done by codeā€¦

https://russian-dima.wixsite.com/login-system/vnloginmgm

import { authorization } from 'wix-members-backend';

export function myAssignRoleFunction() {
  const roleId = "b62310c1-1c81-4ca9-9fe9-42b48f6e164e";
  const memberId = "72751428-2743-4bda-acf5-4218a4279cd3";
  const options = {
    suppressAuth: false
  };

  return authorization.assignRole(roleId, memberId, options)
    .then(() => {
      console.log("Role assigned to member");
    })
    .catch((error) => {
      console.error(error);
    });
}