use plugin helper

This commit is contained in:
Samuel Lorch 2023-04-04 17:06:56 +02:00
parent 480f2c85b7
commit c39c3d6606
2 changed files with 7 additions and 6 deletions

View file

@ -1,6 +1,8 @@
<script setup lang="ts">
import { editTypes } from "../../../../definitions";
import getPlugins from '../../../../plugins';
const p = getPlugins();
const props = $defineProps<{subsystem: string, entity: string, id: string}>();
const { subsystem, entity, id } = $(props);
@ -8,7 +10,7 @@ const { subsystem, entity, id } = $(props);
let data = $ref({} as {});
async function update() {
}
</script>

View file

@ -1,9 +1,8 @@
<script setup lang="ts">
import { editTypes } from "../../../../definitions";
import { apiCall } from "../../../../api";
import { useToast } from 'vue-toast-notification';
const $toast = useToast();
import getPlugins from '../../../../plugins';
const p = getPlugins();
const props = $defineProps<{subsystem: string, entity: string}>();
const { subsystem, entity } = $(props);
@ -14,8 +13,8 @@ async function create(value: any) {
console.debug("value", value);
let res = await apiCall(editTypes[subsystem].name +".Create"+ editTypes[subsystem][entity].name, value);
if (res.Error === null) {
$toast.success("Created " + editTypes[subsystem][entity].name);
$router.go(-1)
p.toast.success("Created " + editTypes[subsystem][entity].name);
p.router.go(-1);
} else {
console.debug("error", res);
}