✨ feat(subscription): Add delete user subscription functionality
This commit is contained in:
parent
9bc3a940ba
commit
1fc3a10c67
@ -2,7 +2,12 @@
|
||||
|
||||
import { Display } from '@/components/display';
|
||||
import { ProTable, ProTableActions } from '@/components/pro-table';
|
||||
import { createUserSubscribe, getUserSubscribe, updateUserSubscribe } from '@/services/admin/user';
|
||||
import {
|
||||
createUserSubscribe,
|
||||
deleteUserSubscribe,
|
||||
getUserSubscribe,
|
||||
updateUserSubscribe,
|
||||
} from '@/services/admin/user';
|
||||
import { Button } from '@workspace/ui/components/button';
|
||||
import { ConfirmButton } from '@workspace/ui/custom-components/confirm-button';
|
||||
import { formatDate } from '@workspace/ui/utils';
|
||||
@ -146,7 +151,9 @@ export default function UserSubscription({ userId }: { userId: number }) {
|
||||
title={t('confirmDelete')}
|
||||
description={t('deleteSubscriptionDescription')}
|
||||
onConfirm={async () => {
|
||||
console.log('Delete subscription:', row.id);
|
||||
await deleteUserSubscribe({ user_subscribe_id: row.id });
|
||||
toast.success(t('deleteSuccess'));
|
||||
ref.current?.refresh();
|
||||
}}
|
||||
cancelText={t('cancel')}
|
||||
confirmText={t('confirm')}
|
||||
|
||||
4
apps/admin/services/admin/typings.d.ts
vendored
4
apps/admin/services/admin/typings.d.ts
vendored
@ -333,6 +333,10 @@ declare namespace API {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type DeleteUserSubscribeRequest = {
|
||||
user_subscribe_id: number;
|
||||
};
|
||||
|
||||
type Document = {
|
||||
id: number;
|
||||
title: string;
|
||||
|
||||
@ -276,6 +276,21 @@ export async function createUserSubscribe(
|
||||
});
|
||||
}
|
||||
|
||||
/** Delete user subcribe DELETE /v1/admin/user/subscribe */
|
||||
export async function deleteUserSubscribe(
|
||||
body: API.DeleteUserSubscribeRequest,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: any }>('/v1/admin/user/subscribe', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** Get user subcribe devices GET /v1/admin/user/subscribe/device */
|
||||
export async function getUserSubscribeDevices(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user