mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 14:47:14 +01:00
Added teams pages. Refactored hooks.
This commit is contained in:
parent
a2c202fa36
commit
9448aa3ab5
136 changed files with 387 additions and 287 deletions
|
|
@ -1,27 +0,0 @@
|
|||
import useStore, { setShareToken } from 'store/app';
|
||||
import useApi from './useApi';
|
||||
|
||||
const selector = (state: { shareToken: string }) => state.shareToken;
|
||||
|
||||
export function useShareToken(shareId: string): {
|
||||
shareToken: any;
|
||||
isLoading?: boolean;
|
||||
error?: Error;
|
||||
} {
|
||||
const shareToken = useStore(selector);
|
||||
const { get, useQuery } = useApi();
|
||||
const { isLoading, error } = useQuery({
|
||||
queryKey: ['share', shareId],
|
||||
queryFn: async () => {
|
||||
const data = await get(`/share/${shareId}`);
|
||||
|
||||
setShareToken(data);
|
||||
|
||||
return data;
|
||||
},
|
||||
});
|
||||
|
||||
return { shareToken, isLoading, error };
|
||||
}
|
||||
|
||||
export default useShareToken;
|
||||
Loading…
Add table
Add a link
Reference in a new issue