Extracted deletion into function of overview

This commit is contained in:
2023-04-12 19:14:42 +02:00
parent da3300562a
commit a0727a0291
2 changed files with 17 additions and 12 deletions

View File

@@ -1,16 +1,14 @@
<script>
import { _ } from "svelte-i18n";
import { clickOutside } from "../base/outsideclick";
import { RunnerService } from "@odit/lfk-client-js";
import Toastify from "toastify-js";
import { createEventDispatcher } from "svelte";
export let modal_open;
export let delete_runner = {
id: 0,
firstname: "",
lastname: "",
};
export let current_runners;
const dispatch = createEventDispatcher();
function focus(el) {
el.focus();
@@ -30,13 +28,7 @@
};
})();
async function submit() {
await RunnerService.runnerControllerRemove(delete_runner.id, true);
current_runners = current_runners.filter((r)=>r.id !== delete_runner.id);
Toastify({
text: $_("runner-deleted"),
duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
dispatch('delete', {id: delete_runner.id})
}
</script>