import axios from 'axios'; import { useState } from './useState'; import useNotify from './useNotify'; export function useUserConfig() { const state = useState(); const { notify } = useNotify(); async function fetch() { try { const { data } = await axios.get('UserConfigs/getUserConfig'); const user = state.getUser().value; user.darkMode = data.darkMode; user.companyFk = data.companyFk; state.setUser(user); return data; } catch (error) { notify('globals.errors.userConfig', 'negative'); console.error('Error fetching user config:', error); } } return { fetch, }; }