form update & token copy
This commit is contained in:
parent
7ded4a21bb
commit
4f13b70ac8
6 changed files with 148 additions and 23 deletions
|
@ -17,8 +17,12 @@
|
|||
@submit.prevent="triggerWebapiUpdate"
|
||||
>
|
||||
<div>
|
||||
<label for="webapi">Bezeichnung</label>
|
||||
<input type="text" id="webapi" required v-model="webapi.title" />
|
||||
<label for="title">Bezeichnung</label>
|
||||
<input type="text" id="title" required v-model="webapi.title" />
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<label for="expiry">Ablaufdatum (optional)</label>
|
||||
<input type="date" id="expiry" step="1" v-model="webapi.expiry" />
|
||||
</div>
|
||||
<div class="flex flex-row justify-end gap-2">
|
||||
<button primary-outline type="reset" class="!w-fit" :disabled="canSaveOrReset" @click="resetForm">
|
||||
|
@ -47,7 +51,8 @@ import FailureXMark from "@/components/FailureXMark.vue";
|
|||
import { RouterLink } from "vue-router";
|
||||
import cloneDeep from "lodash.clonedeep";
|
||||
import isEqual from "lodash.isequal";
|
||||
import type { WebapiViewModel } from "@/viewmodels/admin/user/webapi.models";
|
||||
import type { UpdateWebapiViewModel, WebapiViewModel } from "@/viewmodels/admin/user/webapi.models";
|
||||
import type { Update } from "vite/types/hmrPayload.js";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
@ -96,8 +101,13 @@ export default defineComponent({
|
|||
triggerWebapiUpdate(e: any) {
|
||||
if (this.webapi == null) return;
|
||||
let formData = e.target.elements;
|
||||
let updateWebapi: UpdateWebapiViewModel = {
|
||||
title: formData.title.value,
|
||||
expiry: formData.expiry.value,
|
||||
};
|
||||
|
||||
this.status = "loading";
|
||||
this.updateActiveWebapi(this.webapi.id, formData.webapi.value)
|
||||
this.updateActiveWebapi(this.webapi.id, updateWebapi)
|
||||
.then(() => {
|
||||
this.fetchItem();
|
||||
this.status = { status: "success" };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue