diff --git a/src/composables/useRole.js b/src/composables/useRole.js index a781785a0..0184b23da 100644 --- a/src/composables/useRole.js +++ b/src/composables/useRole.js @@ -1,4 +1,5 @@ import { useState } from './useState'; +import { useUserConfig } from './useUserConfig'; import axios from 'axios'; export function useRole() { @@ -6,6 +7,7 @@ export function useRole() { async function fetch() { const { data } = await axios.get('VnUsers/acl'); + const userConfig = await useUserConfig().fetch(); const roles = data.roles.map((userRoles) => userRoles.role.name); const userData = { @@ -13,7 +15,7 @@ export function useRole() { name: data.user.name, nickname: data.user.nickname, lang: data.user.lang || 'es', - darkMode: data.user.userConfig.darkMode, + darkMode: userConfig.darkMode, }; state.setUser(userData); state.setRoles(roles); diff --git a/src/composables/useUserConfig.js b/src/composables/useUserConfig.js new file mode 100644 index 000000000..0e4837aeb --- /dev/null +++ b/src/composables/useUserConfig.js @@ -0,0 +1,13 @@ +import axios from 'axios'; + +export function useUserConfig() { + + async function fetch() { + const { data } = await axios.get('UserConfigs/getUserConfig'); + return data; + } + + return { + fetch, + }; +}