feat: fix recording save and add publish/unpublish support
- Fix broken fetch("/api/sexy/recordings") → use createRecording GraphQL service
- Round duration to integer before sending (GraphQL Int type)
- Add updateRecording mutation to services
- Add publish/unpublish buttons to RecordingCard (draft ↔ published)
- Remove "Go to Play" button from recordings page header
- Add publish/unpublish i18n keys
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
import DeviceMappingDialog from "./components/device-mapping-dialog.svelte";
|
||||
import type { BluetoothDevice, RecordedEvent, DeviceInfo } from "$lib/types";
|
||||
import { toast } from "svelte-sonner";
|
||||
import { createRecording } from "$lib/services";
|
||||
import SexyBackground from "$lib/components/background/background.svelte";
|
||||
|
||||
// Runtime buttplug values — loaded dynamically from the buttplug nginx container
|
||||
@@ -173,26 +174,16 @@
|
||||
}));
|
||||
|
||||
try {
|
||||
const response = await fetch("/api/sexy/recordings", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title: data.title,
|
||||
description: data.description,
|
||||
duration: recordingDuration,
|
||||
events: recordedEvents,
|
||||
device_info: deviceInfo,
|
||||
tags: data.tags,
|
||||
status: "draft",
|
||||
}),
|
||||
await createRecording({
|
||||
title: data.title,
|
||||
description: data.description,
|
||||
duration: Math.round(recordingDuration),
|
||||
events: recordedEvents,
|
||||
device_info: deviceInfo,
|
||||
tags: data.tags,
|
||||
status: "draft",
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
toast.success("Recording saved successfully!");
|
||||
showSaveDialog = false;
|
||||
recordedEvents = [];
|
||||
|
||||
Reference in New Issue
Block a user