mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 16:17:13 +01:00
Replaced redux with zustand. Fixed login issue, closes #980.
This commit is contained in:
parent
7071f5fba5
commit
9937caa569
33 changed files with 234 additions and 286 deletions
|
|
@ -1,10 +1,9 @@
|
|||
import { useEffect } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { setLocale } from 'redux/actions/app';
|
||||
import { useRouter } from 'next/router';
|
||||
import { get, setItem } from 'lib/web';
|
||||
import { LOCALE_CONFIG } from 'lib/constants';
|
||||
import { getDateLocale, getTextDirection } from 'lib/lang';
|
||||
import useStore, { setLocale } from 'store/app';
|
||||
import useForceUpdate from 'hooks/useForceUpdate';
|
||||
import enUS from 'public/messages/en-US.json';
|
||||
|
||||
|
|
@ -12,9 +11,10 @@ const messages = {
|
|||
'en-US': enUS,
|
||||
};
|
||||
|
||||
const selector = state => state.locale;
|
||||
|
||||
export default function useLocale() {
|
||||
const locale = useSelector(state => state.app.locale);
|
||||
const dispatch = useDispatch();
|
||||
const locale = useStore(selector);
|
||||
const { basePath } = useRouter();
|
||||
const forceUpdate = useForceUpdate();
|
||||
const dir = getTextDirection(locale);
|
||||
|
|
@ -36,7 +36,7 @@ export default function useLocale() {
|
|||
setItem(LOCALE_CONFIG, value);
|
||||
|
||||
if (locale !== value) {
|
||||
dispatch(setLocale(value));
|
||||
setLocale(value);
|
||||
} else {
|
||||
forceUpdate();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue