mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-02 09:26:12 +08:00
✨ 支持删除 CookieTarget
This commit is contained in:
parent
bb63529fe8
commit
bc44e40f56
@ -1,11 +1,10 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import {
|
||||
Button, Empty, Table, Typography,
|
||||
Button, Empty, Space, Table, Typography,
|
||||
} from '@arco-design/web-react';
|
||||
import { useGetCookieTargetsQuery } from '../cookieManager/cookieConfigSlice';
|
||||
import { SubscribeConfig } from '../../utils/type';
|
||||
import { useDeleteSubMutation } from '../subsribeConfigManager/subscribeConfigSlice';
|
||||
import { useDeleteCookieTargetMutation, useGetCookieTargetsQuery } from '../cookieManager/cookieConfigSlice';
|
||||
import { CookieTarget } from '../../utils/type';
|
||||
import CookieTargetModal from './CookieTargetModal';
|
||||
|
||||
export default function () {
|
||||
@ -13,12 +12,18 @@ export default function () {
|
||||
const { data: cookieTargets } = useGetCookieTargetsQuery(cookieId);
|
||||
|
||||
console.log(cookieTargets);
|
||||
const [{ isLoading: deleteIsLoading }] = useDeleteSubMutation();
|
||||
const isLoading = deleteIsLoading;
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
const [deleteCookieTarget] = useDeleteCookieTargetMutation();
|
||||
const handleAdd = () => {
|
||||
setShowModal(true);
|
||||
};
|
||||
const handleDelete = (record: CookieTarget) => () => {
|
||||
deleteCookieTarget({
|
||||
cookieId,
|
||||
target: record.target.target,
|
||||
platformName: record.target.platform_name,
|
||||
});
|
||||
};
|
||||
const columns = [
|
||||
{
|
||||
title: '平台名称',
|
||||
@ -33,6 +38,16 @@ export default function () {
|
||||
title: 'Cookie ID',
|
||||
dataIndex: 'cookie_id',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'op',
|
||||
render: (_: null, record: CookieTarget) => (
|
||||
<Space size="small">
|
||||
<Button type="text" status="danger" onClick={handleDelete(record)}>删除</Button>
|
||||
</Space>
|
||||
),
|
||||
|
||||
},
|
||||
];
|
||||
if (cookieId) {
|
||||
return (
|
||||
@ -44,8 +59,7 @@ export default function () {
|
||||
<Table
|
||||
columns={columns}
|
||||
data={cookieTargets}
|
||||
rowKey={(record: SubscribeConfig) => `${record.platformName}-${record.target}`}
|
||||
loading={isLoading}
|
||||
rowKey={(record: CookieTarget) => `${record.target.platform_name}-${record.target.target}`}
|
||||
scroll={{ x: true }}
|
||||
/>
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user