Feat: Quit from jointed team #3759 (#3797)

### What problem does this PR solve?

Feat: Quit from jointed team #3759

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-12-02 15:31:41 +08:00
committed by GitHub
parent 8fba5c4179
commit 976d112280
5 changed files with 36 additions and 2 deletions

View File

@ -1,16 +1,18 @@
import { useListTenant } from '@/hooks/user-setting-hooks';
import { useFetchUserInfo, useListTenant } from '@/hooks/user-setting-hooks';
import { ITenant } from '@/interfaces/database/user-setting';
import { formatDate } from '@/utils/date';
import type { TableProps } from 'antd';
import { Button, Space, Table } from 'antd';
import { useTranslation } from 'react-i18next';
import { TenantRole } from '../constants';
import { useHandleAgreeTenant } from './hooks';
import { useHandleAgreeTenant, useHandleQuitUser } from './hooks';
const TenantTable = () => {
const { t } = useTranslation();
const { data, loading } = useListTenant();
const { handleAgree } = useHandleAgreeTenant();
const { data: user } = useFetchUserInfo();
const { handleQuitTenantUser } = useHandleQuitUser();
const columns: TableProps<ITenant>['columns'] = [
{
@ -46,6 +48,15 @@ const TenantTable = () => {
</Button>
</Space>
);
} else if (role === TenantRole.Normal && user.id !== tenant_id) {
return (
<Button
type="link"
onClick={handleQuitTenantUser(user.id, tenant_id)}
>
{t('setting.quit')}
</Button>
);
}
},
},