46 lines
902 B
Svelte
46 lines
902 B
Svelte
<script>
|
|
import { goto } from '$app/navigation';
|
|
|
|
import {
|
|
Button,
|
|
Container,
|
|
Form,
|
|
Icon,
|
|
Input,
|
|
ListGroup,
|
|
ListGroupItem,
|
|
Spinner,
|
|
} from '@sveltestrap/sveltestrap';
|
|
|
|
import { gongs } from '$lib/stores/gongs';
|
|
import { uploadGong } from '$lib/gong';
|
|
|
|
function submitGong() {
|
|
if (files.length == 0) {
|
|
alert("Vous n'avez sélectionné aucun fichier !")
|
|
return false;
|
|
}
|
|
|
|
uploadGong(files).then((gong) => {
|
|
gongs.refresh();
|
|
goto('musiks/gongs/' + gong.id);
|
|
})
|
|
}
|
|
|
|
export let files = [];
|
|
</script>
|
|
|
|
<Container>
|
|
<h2>
|
|
Nouveau gong
|
|
</h2>
|
|
|
|
<form on:submit|preventDefault={submitGong}>
|
|
<Input type="file" bind:files />
|
|
|
|
<Button type="submit" color="primary" class="mt-2" disabled={files.length == 0}>
|
|
Ajouter ce gong
|
|
</Button>
|
|
</form>
|
|
</Container>
|