mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-06-23 14:16:52 +08:00
✨ 添加 CookieTarget 页面
This commit is contained in:
+26
-11
@@ -3,6 +3,7 @@ import {
|
||||
Button,
|
||||
Card, Descriptions, Grid, List, Popconfirm, Popover, Typography,
|
||||
} from '@arco-design/web-react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { selectSiteConf } from '../globalConf/globalConfSlice';
|
||||
import { useAppSelector } from '../../app/hooks';
|
||||
import { Cookie, SiteConfig } from '../../utils/type';
|
||||
@@ -10,8 +11,8 @@ import { useGetCookiesQuery, useDeleteCookieMutation } from './cookieConfigSlice
|
||||
import CookieModal from './CookieModal';
|
||||
|
||||
interface CookieSite {
|
||||
site: SiteConfig;
|
||||
cookies: Cookie[];
|
||||
site: SiteConfig;
|
||||
cookies: Cookie[];
|
||||
}
|
||||
|
||||
export default function CookieManager() {
|
||||
@@ -54,7 +55,7 @@ export default function CookieManager() {
|
||||
>
|
||||
添加
|
||||
</Button>
|
||||
)}
|
||||
)}
|
||||
>
|
||||
|
||||
{cookies.map((cookie) => (
|
||||
@@ -75,17 +76,31 @@ export default function CookieManager() {
|
||||
value: typeof (entry[1]) === 'object' ? JSON.stringify(entry[1]) : entry[1].toString(),
|
||||
}))}
|
||||
/>
|
||||
)}
|
||||
)}
|
||||
>
|
||||
{cookie.friendly_name}
|
||||
</Popover>
|
||||
<Popconfirm
|
||||
title={`确定删除 Cookie ${cookie.friendly_name} ?`}
|
||||
onOk={handleDelCookie(cookie.id.toString())}
|
||||
>
|
||||
|
||||
<Button type="primary" status="danger">删除</Button>
|
||||
</Popconfirm>
|
||||
</Popover>
|
||||
|
||||
<div>
|
||||
|
||||
<Link to={`/home/cookie/${cookie.id}`}>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginRight: '10px' }}
|
||||
>
|
||||
关联详情
|
||||
</Button>
|
||||
</Link>
|
||||
<Popconfirm
|
||||
title={`确定删除 Cookie ${cookie.friendly_name} ?`}
|
||||
onOk={handleDelCookie(cookie.id.toString())}
|
||||
>
|
||||
|
||||
<Button type="primary" status="danger">删除</Button>
|
||||
</Popconfirm>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</List.Item>
|
||||
</List>
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createApi } from '@reduxjs/toolkit/query/react';
|
||||
import {
|
||||
StatusResp, Cookie, NewCookieParam, DelCookieParam,
|
||||
StatusResp, Cookie, NewCookieParam,
|
||||
DelCookieParam, CookieTarget, NewCookieTargetParam, DelCookieTargetParam,
|
||||
} from '../../utils/type';
|
||||
import { baseQueryWithAuth } from '../auth/authQuery';
|
||||
|
||||
@@ -33,3 +34,35 @@ export const cookieApi = createApi({
|
||||
export const {
|
||||
useGetCookiesQuery, useNewCookieMutation, useDeleteCookieMutation,
|
||||
} = cookieApi;
|
||||
|
||||
export const cookieTargetApi = createApi({
|
||||
reducerPath: 'cookieTarget',
|
||||
baseQuery: baseQueryWithAuth,
|
||||
tagTypes: ['CookieTarget'],
|
||||
endpoints: (builder) => ({
|
||||
getCookieTargets: builder.query<CookieTarget, { site_name: string, cookie_id: number }>({
|
||||
query: () => '/cookie_target?site_name=site_name&cookie_id=cookie_id',
|
||||
providesTags: ['CookieTarget'],
|
||||
}),
|
||||
newCookieTarget: builder.mutation<StatusResp, NewCookieTargetParam>({
|
||||
query: ({ platformName, target, cookieId }) => ({
|
||||
method: 'POST',
|
||||
url: '/cookie_target',
|
||||
body: { platform_name: platformName, target, cookie_id: cookieId },
|
||||
}),
|
||||
invalidatesTags: ['CookieTarget'],
|
||||
}),
|
||||
deleteCookieTarget: builder.mutation<StatusResp, DelCookieTargetParam>({
|
||||
query: ({ platformName, target, cookieId }) => ({
|
||||
method: 'DELETE',
|
||||
url: '/cookie_target',
|
||||
body: { platform_name: platformName, target, cookie_id: cookieId },
|
||||
}),
|
||||
invalidatesTags: ['CookieTarget'],
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
export const {
|
||||
useGetCookieTargetsQuery, useNewCookieTargetMutation, useDeleteCookieTargetMutation,
|
||||
} = cookieTargetApi;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<h1>再等等</h1>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user