Skip to content

Option rolesVar to support a response role type object. #300

Description

@themaxaboy

When I use vue-auth-plugin with strapi headless cms, the login api gets a role response as a object type.

user: {
    blocked: false,
    confirmed: false,
    created_at: "2020-09-25T20:58:22.478Z",
    email: "user@user.com",
    id: 1,
    provider: "local",
    role: {
        description: "Default role given to authenticated user.",
        id: 1,
        name: "Authenticated",
        type: "authenticated",
    },
    updated_at: "2020-09-25T20:58:22.487Z",
    username: "user"
}

I think the rolesVar option should be set to a string with dot for access the object like lodash get.

_.get(object, 'a.b.c', 'default');

For me rolesVar is "role.type"

An alternative is to add a customRole like customToken.

customToken: (response) => response.data['token']
customRole: (response) => response.data['user']['role']['type']

Please consider thank you and sorry for my writing.

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions