mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 18:00:17 +01:00
go back to team settings on team delete
This commit is contained in:
parent
0016a9f4e1
commit
8969a010e8
@ -1,9 +1,17 @@
|
|||||||
import { ActionForm, Button, Modal, ModalTrigger } from 'react-basics';
|
|
||||||
import { useMessages } from 'components/hooks';
|
import { useMessages } from 'components/hooks';
|
||||||
|
import { useRouter } from 'next/navigation';
|
||||||
|
import { ActionForm, Button, Modal, ModalTrigger } from 'react-basics';
|
||||||
import TeamDeleteForm from './TeamDeleteForm';
|
import TeamDeleteForm from './TeamDeleteForm';
|
||||||
|
import { touch } from 'store/modified';
|
||||||
|
|
||||||
export function TeamAdmin({ teamId }: { teamId: string }) {
|
export function TeamAdmin({ teamId }: { teamId: string }) {
|
||||||
const { formatMessage, labels, messages } = useMessages();
|
const { formatMessage, labels, messages } = useMessages();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const handleLeave = async () => {
|
||||||
|
touch('teams');
|
||||||
|
router.push('/settings/teams');
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActionForm
|
<ActionForm
|
||||||
@ -13,7 +21,9 @@ export function TeamAdmin({ teamId }: { teamId: string }) {
|
|||||||
<ModalTrigger>
|
<ModalTrigger>
|
||||||
<Button variant="danger">{formatMessage(labels.delete)}</Button>
|
<Button variant="danger">{formatMessage(labels.delete)}</Button>
|
||||||
<Modal title={formatMessage(labels.deleteTeam)}>
|
<Modal title={formatMessage(labels.deleteTeam)}>
|
||||||
{(close: () => void) => <TeamDeleteForm teamId={teamId} onClose={close} />}
|
{(close: () => void) => (
|
||||||
|
<TeamDeleteForm teamId={teamId} onSave={handleLeave} onClose={close} />
|
||||||
|
)}
|
||||||
</Modal>
|
</Modal>
|
||||||
</ModalTrigger>
|
</ModalTrigger>
|
||||||
</ActionForm>
|
</ActionForm>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { useApi, useMessages } from 'components/hooks';
|
|
||||||
import { touch } from 'store/modified';
|
|
||||||
import TypeConfirmationForm from 'components/common/TypeConfirmationForm';
|
import TypeConfirmationForm from 'components/common/TypeConfirmationForm';
|
||||||
|
import { useApi, useMessages } from 'components/hooks';
|
||||||
|
|
||||||
const CONFIRM_VALUE = 'DELETE';
|
const CONFIRM_VALUE = 'DELETE';
|
||||||
|
|
||||||
@ -22,7 +21,6 @@ export function TeamDeleteForm({
|
|||||||
const handleConfirm = async () => {
|
const handleConfirm = async () => {
|
||||||
mutate(null, {
|
mutate(null, {
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
touch('teams');
|
|
||||||
onSave?.();
|
onSave?.();
|
||||||
onClose?.();
|
onClose?.();
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user