feat(changedetection): add delete watch action

This commit is contained in:
Rıdvan Akca
2024-05-13 16:25:15 +02:00
parent 58c90da385
commit c62aea3852
3 changed files with 33 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Delete a watch',
key: 'deleteWatch',
description: 'Deletes a change detection watch.',
arguments: [
{
label: 'Watch ID',
key: 'watchId',
type: 'string',
required: true,
variables: true,
description: 'Watch id you want to delete',
},
],
async run($) {
const watchId = $.step.parameters.watchId;
await $.http.delete(`/v1/watch/${watchId}`);
$.setActionItem({
raw: {
result: 'successful',
},
});
},
});

View File

@@ -1,3 +1,4 @@
import createWatch from './create-watch/index.js';
import deleteWatch from './delete-watch/index.js';
export default [createWatch];
export default [createWatch, deleteWatch];

View File

@@ -3,6 +3,8 @@ favicon: /favicons/changedetection.svg
items:
- name: Create a watch
desc: Creates a new change detection watch for a specific website.
- name: Delete a watch
desc: Deletes a change detection watch.
---
<script setup>