Add button to delete tracks and gongs

This commit is contained in:
nemunaire 2022-10-15 11:13:45 +02:00
parent e9a906fbfb
commit 46e8d1a1d2
2 changed files with 42 additions and 0 deletions

View File

@ -1,15 +1,25 @@
<script>
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import {
Container,
Input,
Icon,
ListGroup,
ListGroupItem,
Spinner,
} from 'sveltestrap';
import { getGong } from '$lib/gong';
import { gongs } from '$lib/stores/gongs';
function deleteThis(gong) {
gong.delete().then(() => {
gongs.refresh();
goto('musiks/gongs/');
})
}
</script>
{#await getGong($page.params.gid)}
@ -35,5 +45,17 @@
<span class="text-muted">{gong.id}</span>
</ListGroupItem>
</ListGroup>
<ListGroup class="my-2 text-center">
<ListGroupItem
action
tag="button"
class="text-danger fw-bold"
on:click={() => deleteThis(gong)}
>
<Icon name="trash" />
Supprimer ce gong
</ListGroupItem>
</ListGroup>
</Container>
{/await}

View File

@ -12,6 +12,14 @@
} from 'sveltestrap';
import { getTrack } from '$lib/track';
import { tracks } from '$lib/stores/tracks';
function deleteThis(track) {
track.delete().then(() => {
tracks.refresh();
goto('musiks/tracks/');
})
}
</script>
{#await getTrack($page.params.tid)}
@ -37,5 +45,17 @@
<span class="text-muted">{track.id}</span>
</ListGroupItem>
</ListGroup>
<ListGroup class="my-2 text-center">
<ListGroupItem
action
tag="button"
class="text-danger fw-bold"
on:click={() => deleteThis(track)}
>
<Icon name="trash" />
Supprimer cette piste
</ListGroupItem>
</ListGroup>
</Container>
{/await}