mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
Added "use client" to hooks.
This commit is contained in:
parent
400657d59e
commit
238e6efee2
@ -30,6 +30,7 @@
|
||||
"rules": {
|
||||
"no-console": "error",
|
||||
"react/display-name": "off",
|
||||
"react-hooks/exhaustive-deps": "off",
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"react/prop-types": "off",
|
||||
"import/no-anonymous-default-export": "off",
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { REPORT_PARAMETERS } from 'lib/constants';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import * as reactQuery from '@tanstack/react-query';
|
||||
import { useApi as nextUseApi } from 'next-basics';
|
||||
import { getClientAuthToken } from 'lib/client';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useEffect } from 'react';
|
||||
import useStore, { setConfig } from 'store/app';
|
||||
import { useApi } from './useApi';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { UseQueryOptions } from '@tanstack/react-query';
|
||||
import { useState, Dispatch, SetStateAction } from 'react';
|
||||
import { useApi } from './useApi';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useStore, { setUser } from 'store/app';
|
||||
import useApi from './useApi';
|
||||
import { UseQueryResult } from '@tanstack/react-query';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { produce } from 'immer';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useApi } from './useApi';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useApi from './useApi';
|
||||
import useFilterQuery from './useFilterQuery';
|
||||
import useCache from 'store/cache';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useStore, { setShareToken } from 'store/app';
|
||||
import useApi from './useApi';
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useApi from './useApi';
|
||||
|
||||
export function useTeam(teamId: string) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useApi from './useApi';
|
||||
import useFilterQuery from './useFilterQuery';
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useApi from './useApi';
|
||||
import useFilterQuery from './useFilterQuery';
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useApi from './useApi';
|
||||
|
||||
export function useUser(userId: string, options?: { [key: string]: any }) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useApi from './useApi';
|
||||
import useFilterQuery from './useFilterQuery';
|
||||
import useCache from 'store/cache';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useApi from './useApi';
|
||||
|
||||
export function useWebsite(websiteId: string, options?: { [key: string]: any }) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useApi from './useApi';
|
||||
import { UseQueryOptions } from '@tanstack/react-query';
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useApi from './useApi';
|
||||
import { UseQueryOptions } from '@tanstack/react-query';
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useApi } from './useApi';
|
||||
import { useFilterQuery } from './useFilterQuery';
|
||||
import { useLogin } from './useLogin';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { httpGet } from 'next-basics';
|
||||
import enUS from '../../../public/intl/country/en-US.json';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { getMinimumUnit, parseDateRange } from 'lib/date';
|
||||
import { setItem } from 'next-basics';
|
||||
import { DATE_RANGE_CONFIG, DEFAULT_DATE_RANGE } from 'lib/constants';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export function useDocumentClick(handler: (event: MouseEvent) => any) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useEffect, useCallback, KeyboardEvent } from 'react';
|
||||
|
||||
export function useEscapeKey(handler: (event: KeyboardEvent) => void) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useMessages } from './useMessages';
|
||||
import { OPERATORS } from 'lib/constants';
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
export function useForceUpdate() {
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import useMessages from './useMessages';
|
||||
import { BROWSERS } from 'lib/constants';
|
||||
import useLocale from './useLocale';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { httpGet } from 'next-basics';
|
||||
import enUS from '../../../public/intl/language/en-US.json';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useEffect } from 'react';
|
||||
import { httpGet, setItem } from 'next-basics';
|
||||
import { LOCALE_CONFIG } from 'lib/constants';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { useIntl, FormattedMessage, MessageDescriptor, PrimitiveType } from 'react-intl';
|
||||
'use client';
|
||||
import { useIntl, FormattedMessage } from 'react-intl';
|
||||
import { messages, labels } from 'components/messages';
|
||||
import { FormatXMLElementFn, Options } from 'intl-messageformat';
|
||||
|
||||
export function useMessages(): any {
|
||||
const intl = useIntl();
|
||||
@ -12,14 +12,12 @@ export function useMessages(): any {
|
||||
};
|
||||
|
||||
const formatMessage = (
|
||||
descriptor:
|
||||
| MessageDescriptor
|
||||
| {
|
||||
id: string;
|
||||
defaultMessage: string;
|
||||
},
|
||||
values?: Record<string, PrimitiveType | FormatXMLElementFn<string, string>>,
|
||||
opts?: Options,
|
||||
descriptor: {
|
||||
id: string;
|
||||
defaultMessage: string;
|
||||
},
|
||||
values?: { [key: string]: string },
|
||||
opts?: any,
|
||||
) => {
|
||||
return descriptor ? intl.formatMessage(descriptor, values, opts) : null;
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useMemo } from 'react';
|
||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||
import { buildUrl } from 'next-basics';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
|
||||
export function useSticky({ enabled = true, threshold = 1 }) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
export function useTeamContext(): {
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useEffect } from 'react';
|
||||
import useStore, { setTheme } from 'store/app';
|
||||
import { getItem, setItem } from 'next-basics';
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use client';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { getTimezone } from 'lib/date';
|
||||
import { getItem, setItem } from 'next-basics';
|
||||
|
Loading…
Reference in New Issue
Block a user