mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +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,19 +1,19 @@
|
|||
import { useEffect } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { useRouter } from 'next/router';
|
||||
import { get } from 'lib/web';
|
||||
import { setShareToken } from 'redux/actions/app';
|
||||
import useStore, { setShareToken } from 'store/app';
|
||||
|
||||
const selector = state => state.shareToken;
|
||||
|
||||
export default function useShareToken(shareId) {
|
||||
const { basePath } = useRouter();
|
||||
const dispatch = useDispatch();
|
||||
const shareToken = useSelector(state => state.app.shareToken);
|
||||
const shareToken = useStore(selector);
|
||||
|
||||
async function loadToken(id) {
|
||||
const { data } = await get(`${basePath}/api/share/${id}`);
|
||||
|
||||
if (data) {
|
||||
dispatch(setShareToken(data));
|
||||
setShareToken(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue