mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
parent
f547f2b0ec
commit
69b81880cb
7 changed files with 38 additions and 38 deletions
|
|
@ -1,16 +1,15 @@
|
|||
import { useEffect } from 'react';
|
||||
import { useRouter } from 'next/router';
|
||||
import { get } from 'lib/web';
|
||||
import useStore, { setShareToken } from 'store/app';
|
||||
import useApi from './useApi';
|
||||
|
||||
const selector = state => state.shareToken;
|
||||
|
||||
export default function useShareToken(shareId) {
|
||||
const { basePath } = useRouter();
|
||||
const shareToken = useStore(selector);
|
||||
const { get } = useApi();
|
||||
|
||||
async function loadToken(id) {
|
||||
const { data } = await get(`${basePath}/api/share/${id}`);
|
||||
const { data } = await get(`/share/${id}`);
|
||||
|
||||
if (data) {
|
||||
setShareToken(data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue