refs #5655 added useUserConfig
gitea/salix-front/pipeline/head There was a failure building this commit
Details
gitea/salix-front/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
b674bc4d41
commit
1627f9cd36
|
@ -1,4 +1,5 @@
|
||||||
import { useState } from './useState';
|
import { useState } from './useState';
|
||||||
|
import { useUserConfig } from './useUserConfig';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
export function useRole() {
|
export function useRole() {
|
||||||
|
@ -6,6 +7,7 @@ export function useRole() {
|
||||||
|
|
||||||
async function fetch() {
|
async function fetch() {
|
||||||
const { data } = await axios.get('VnUsers/acl');
|
const { data } = await axios.get('VnUsers/acl');
|
||||||
|
const userConfig = await useUserConfig().fetch();
|
||||||
const roles = data.roles.map((userRoles) => userRoles.role.name);
|
const roles = data.roles.map((userRoles) => userRoles.role.name);
|
||||||
|
|
||||||
const userData = {
|
const userData = {
|
||||||
|
@ -13,7 +15,7 @@ export function useRole() {
|
||||||
name: data.user.name,
|
name: data.user.name,
|
||||||
nickname: data.user.nickname,
|
nickname: data.user.nickname,
|
||||||
lang: data.user.lang || 'es',
|
lang: data.user.lang || 'es',
|
||||||
darkMode: data.user.userConfig.darkMode,
|
darkMode: userConfig.darkMode,
|
||||||
};
|
};
|
||||||
state.setUser(userData);
|
state.setUser(userData);
|
||||||
state.setRoles(roles);
|
state.setRoles(roles);
|
||||||
|
|
|
@ -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,
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue