warning korrigiert
This commit is contained in:
@@ -4,14 +4,14 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
/**
|
||||
* @type any[]
|
||||
*/
|
||||
let list = [];
|
||||
let list: any[] = [];
|
||||
//$: list;
|
||||
|
||||
onMount(async () => {
|
||||
@@ -36,11 +36,13 @@
|
||||
}
|
||||
});
|
||||
|
||||
async function delete_item(ev) {
|
||||
async function delete_item(ev: Event) {
|
||||
let delete_item = window.confirm("Bist du sicher?");
|
||||
|
||||
if (delete_item) {
|
||||
let filename = event.currentTarget.id.split('del__')[1]
|
||||
const target = ev.currentTarget as HTMLElement | null;
|
||||
if (!target) return;
|
||||
let filename = target.id.split('del__')[1]
|
||||
|
||||
// delete request
|
||||
// --------------
|
||||
@@ -56,7 +58,11 @@
|
||||
setTimeout(() => {window.location.reload()}, 500)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error.message)
|
||||
if (error instanceof Error) {
|
||||
console.log(error.message);
|
||||
} else {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -95,6 +101,7 @@
|
||||
style="padding: 2px"
|
||||
id="del__{item.name}"
|
||||
on:click|preventDefault={delete_item}
|
||||
aria-label="Vorgang {item.name} löschen"
|
||||
>
|
||||
<svg
|
||||
height="20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="m8 3v1 1h1v-1h4v1h1v-1-1zm-4 3v1h14v-1zm2 2v11h1 9v-1-10h-1v10h-8v-10z" fill="#373737" transform="translate(1 1)"/></svg>
|
||||
|
||||
Reference in New Issue
Block a user