mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 08:07:12 +01:00
Use context hooks.
This commit is contained in:
parent
00adb00d2d
commit
600a3d28c3
13 changed files with 46 additions and 44 deletions
|
|
@ -8,9 +8,7 @@ import {
|
|||
useToast,
|
||||
} from '@umami/react-zen';
|
||||
import { getRandomChars } from '@/lib/crypto';
|
||||
import { useContext } from 'react';
|
||||
import { useApi, useMessages, useModified } from '@/components/hooks';
|
||||
import { TeamContext } from '@/app/(main)/teams/TeamProvider';
|
||||
import { useApi, useMessages, useModified, useTeam } from '@/components/hooks';
|
||||
|
||||
const generateId = () => `team_${getRandomChars(16)}`;
|
||||
|
||||
|
|
@ -23,7 +21,7 @@ export function TeamEditForm({
|
|||
allowEdit?: boolean;
|
||||
onSave?: () => void;
|
||||
}) {
|
||||
const team = useContext(TeamContext);
|
||||
const team = useTeam();
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
const { post, useMutation } = useApi();
|
||||
const { toast } = useToast();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { useContext, useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { Column, Tabs, TabList, Tab, TabPanel } from '@umami/react-zen';
|
||||
import { TeamContext } from '@/app/(main)/teams/TeamProvider';
|
||||
import { useLoginQuery, useMessages, useNavigation } from '@/components/hooks';
|
||||
import { useLoginQuery, useMessages, useNavigation, useTeam } from '@/components/hooks';
|
||||
|
||||
import { ROLES } from '@/lib/constants';
|
||||
import { Users } from '@/components/icons';
|
||||
|
|
@ -14,7 +13,7 @@ import { PageHeader } from '@/components/common/PageHeader';
|
|||
import { Panel } from '@/components/common/Panel';
|
||||
|
||||
export function TeamSettings({ teamId }: { teamId: string }) {
|
||||
const team = useContext(TeamContext);
|
||||
const team = useTeam();
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { user } = useLoginQuery();
|
||||
const { query, pathname } = useNavigation();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue