Intevel/nuxt-directus

Wrong fetchUserParams parse

LynxTR opened this issue · 1 comments

LynxTR commented

Version

frontend:
nuxt-directus: ^5.5.0
nuxt: ^3.6.3

backend:
directus: ^10.1.1

Steps to reproduce

nuxt.config:

 directus: {
    url: "http://0.0.0.0:8055",
    autoFetch: true,
    fetchUserParams: {
      fields: ['email', 'first_name', 'last_name']
    }
 },

login.vue:

function onLoginSubmit() {
    login(loginFields.value).then(res => {
        router.push('/');
    }).catch((err) => {
        console.error(err);
    })
}

What is Expected?

It should parse the fetchUserParams same way as Directus. Directus' user fetch after the successful login: http://0.0.0.0:8055/users/me?fields[]=id&fields[]=first_name&fields[]=last_name&fields[]=email&fields[]=last_page&fields[]=theme&fields[]=tfa_secret&fields[]=avatar.id&fields[]=role.admin_access&fields[]=role.app_access&fields[]=role.id&fields[]=role.enforce_tfa

What is actually happening?

nuxt-directus parsed the query names without [], in result: http://0.0.0.0:8055/users/me?fields=email&fields=first_name&fields=last_name. And directus responded with only the user id.

The new v6 module is out; the v5 version is EOL.

v6 is still in beta but will be released once we get enough feedback to consider it stable.
--> https://next.nuxt-directus.site/