Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

1.7 KB
Raw Blame
<script setup lang="ts">
import { router } from '@inertiajs/vue3';
import { ref } from 'vue';

import { Button } from '@/components/ui/button';
import {
    Dialog,
    DialogContent,
    DialogDescription,
    DialogFooter,
    DialogHeader,
    DialogTitle,
} from '@/components/ui/dialog';
import { rotateSecret } from '@/routes/app/webhooks';

const props = defineProps<{
    webhookId: string;
}>();

const open = defineModel<boolean>('open', { default: false });

const closeDialog = (): void => {
    open.value = false;
};

const rotating = ref(false);

const handleRotate = () => {
    rotating.value = true;
    router.post(
        rotateSecret.url(props.webhookId),
        {},
        {
            preserveScroll: true,
            onFinish: () => {
                rotating.value = false;
                open.value = false;
            },
        },
    );
};
</script>

<template>
    <Dialog v-model:open="open">
        <DialogContent>
            <DialogHeader>
                <DialogTitle>{{ $t('webhooks.rotate.title') }}</DialogTitle>
                <DialogDescription>
                    {{ $t('webhooks.rotate.description') }}
                </DialogDescription>
            </DialogHeader>
            <DialogFooter>
                <Button variant="ghost" @click="closeDialog">
                    {{ $t('webhooks.rotate.cancel') }}
                </Button>
                <Button
                    data-testid="rotate-secret-submit"
                    :disabled="rotating"
                    @click="handleRotate"
                >
                    {{ $t('webhooks.rotate.submit') }}
                </Button>
            </DialogFooter>
        </DialogContent>
    </Dialog>
</template>