settings work
This commit is contained in:
@ -15,6 +15,7 @@ import { restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
||||
import AudioTrimmer from './AudioTrimer';
|
||||
import { ClipMetadata } from '../../redux/types';
|
||||
import { useAppDispatch, useAppSelector } from '../hooks';
|
||||
import { apiFetch } from '../api';
|
||||
|
||||
export interface ClipListProps {
|
||||
collection: string;
|
||||
@ -77,19 +78,16 @@ export default function ClipList({ collection }: ClipListProps) {
|
||||
payload: { collection, newMetadata },
|
||||
});
|
||||
try {
|
||||
const response = await fetch(
|
||||
'http://localhost:5010/meta/collection/clips/reorder',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: collection,
|
||||
clips: newMetadata.clips,
|
||||
}),
|
||||
const response = await apiFetch('meta/collection/clips/reorder', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
);
|
||||
body: JSON.stringify({
|
||||
name: collection,
|
||||
clips: newMetadata.clips,
|
||||
}),
|
||||
});
|
||||
const data = await response.json();
|
||||
console.log('handle reorder return:', data.collections);
|
||||
dispatch({ type: 'metadata/setAllData', payload: data });
|
||||
@ -105,7 +103,7 @@ export default function ClipList({ collection }: ClipListProps) {
|
||||
type: 'metadata/deleteClip',
|
||||
payload: { collection, clip: meta },
|
||||
});
|
||||
fetch('http://localhost:5010/meta/collection/clips/remove', {
|
||||
apiFetch('meta/collection/clips/remove', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -126,7 +124,7 @@ export default function ClipList({ collection }: ClipListProps) {
|
||||
type: 'metadata/moveClip',
|
||||
payload: { sourceCollection: collection, targetCollection, clip: meta },
|
||||
});
|
||||
fetch('http://localhost:5010/meta/collection/clips/move', {
|
||||
apiFetch('meta/collection/clips/move', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -147,19 +145,16 @@ export default function ClipList({ collection }: ClipListProps) {
|
||||
type: 'metadata/editClip',
|
||||
payload: { collection, clip: meta },
|
||||
});
|
||||
const response = await fetch(
|
||||
'http://localhost:5010/meta/collection/clips/edit',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: collection,
|
||||
clip: meta,
|
||||
}),
|
||||
const response = await apiFetch('meta/collection/clips/edit', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
);
|
||||
body: JSON.stringify({
|
||||
name: collection,
|
||||
clip: meta,
|
||||
}),
|
||||
});
|
||||
await response.json();
|
||||
// console.log('handle clip save return:', data.collections);
|
||||
dispatch({
|
||||
|
||||
Reference in New Issue
Block a user