mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Added useLocale hook.
This commit is contained in:
parent
7e26c9571e
commit
52acb691ad
5 changed files with 24 additions and 14 deletions
13
hooks/useLocale.js
Normal file
13
hooks/useLocale.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { updateApp } from 'redux/actions/app';
|
||||
|
||||
export default function useLocale() {
|
||||
const locale = useSelector(state => state.app.locale);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
function setLocale(value) {
|
||||
dispatch(updateApp({ locale: value }));
|
||||
}
|
||||
|
||||
return [locale, setLocale];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue