fix:#28 fixed info panel and edited backend api for fix

This commit is contained in:
Elmar Kresse
2023-10-27 00:03:14 +02:00
parent c874cbed30
commit 090342736d
6 changed files with 27 additions and 23 deletions

View File

@@ -1,12 +1,12 @@
import { Module } from "../model/module";
export async function fetchModule(name: string): Promise<Module> {
export async function fetchModule(module: Module): Promise<Module> {
const request = new Request("/api/module", {
method: "GET",
method: "POST",
headers: {
"Content-Type": "application/json",
Name: encodeURI(name),
},
body: JSON.stringify(module),
});
return await fetch(request)

View File

@@ -38,10 +38,9 @@ const ModuleInformation = defineAsyncComponent(
() => import("./ModuleInformation.vue"),
);
async function showInfo(moduleName: string) {
const module: Ref<Module> = ref(new Module("", "", "", "", "", "", []));
await fetchModule(moduleName).then((data) => {
module.value = data;
async function showInfo(module: Module) {
await fetchModule(module).then((data) => {
module = data;
});
dialog.open(ModuleInformation, {
props: {
@@ -66,7 +65,7 @@ const selectAll = ref(false);
const onSelectAllChange = (event: MultiSelectAllChangeEvent) => {
selectedModules.value = event.checked
? modules.value.map((module) => module)
? modules.value.map((module: Module) => module)
: [];
selectAll.value = event.checked;
};
@@ -112,7 +111,7 @@ function selectChange() {
rounded
outlined
aria-label="Information"
@click.stop="showInfo(slotProps.option.name)"
@click.stop="showInfo(slotProps.option)"
></Button>
<DynamicDialog />
</div>

View File

@@ -36,9 +36,8 @@ const ModuleInformation = defineAsyncComponent(
() => import("../ModuleInformation.vue"),
);
async function showInfo(moduleName: string) {
const module: Ref<Module> = ref(new Module("", "", "", "", "", "", []));
await fetchModule(moduleName).then((data) => {
async function showInfo(module: Module) {
await fetchModule(module).then((data) => {
module.value = data;
});
dialog.open(ModuleInformation, {
@@ -110,7 +109,7 @@ function selectChange() {
rounded
outlined
aria-label="Information"
@click.stop="showInfo(slotProps.option.name)"
@click.stop="showInfo(slotProps.option)"
></Button>
<DynamicDialog />
</div>