mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 00:27:11 +01:00
Updated teams button.
This commit is contained in:
parent
8048bc7866
commit
44393472cf
12 changed files with 46 additions and 55 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import DataTable from 'components/common/DataTable';
|
||||
import TeamsTable from 'app/(main)/settings/teams/TeamsTable';
|
||||
import { useTeams } from 'components/hooks';
|
||||
import { useLogin, useTeams } from 'components/hooks';
|
||||
|
||||
export function TeamsDataTable({
|
||||
allowEdit,
|
||||
|
|
@ -9,7 +9,8 @@ export function TeamsDataTable({
|
|||
allowEdit?: boolean;
|
||||
showActions?: boolean;
|
||||
}) {
|
||||
const queryResult = useTeams();
|
||||
const { user } = useLogin();
|
||||
const queryResult = useTeams(user.id);
|
||||
|
||||
return (
|
||||
<DataTable queryResult={queryResult}>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Button, Modal, ModalTrigger, ActionForm } from 'react-basics';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useLogin, useMessages, useModified, useTeamUrl } from 'components/hooks';
|
||||
import { useLogin, useMessages, useModified, useTeams, useTeamUrl } from 'components/hooks';
|
||||
import WebsiteDeleteForm from './WebsiteDeleteForm';
|
||||
import WebsiteResetForm from './WebsiteResetForm';
|
||||
import WebsiteTransferForm from './WebsiteTransferForm';
|
||||
|
|
@ -12,11 +12,12 @@ export function WebsiteData({ websiteId, onSave }: { websiteId: string; onSave?:
|
|||
const { touch } = useModified();
|
||||
const { teamId, renderTeamUrl } = useTeamUrl();
|
||||
const router = useRouter();
|
||||
const hasTeams = user?.teams?.length > 0;
|
||||
const { result } = useTeams(user.id);
|
||||
const hasTeams = result?.data?.length > 0;
|
||||
const isTeamOwner =
|
||||
(!teamId && hasTeams) ||
|
||||
(hasTeams &&
|
||||
user?.teams
|
||||
result?.data
|
||||
?.find(({ id }) => id === teamId)
|
||||
?.teamUser.find(({ role, userId }) => role === ROLES.teamOwner && userId === user.id));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue