fix: dialog status handling

This commit is contained in:
Julian Krauser 2025-01-13 10:24:03 +01:00
parent 22359c3bea
commit 0ee5a92c95
44 changed files with 130 additions and 44 deletions

View file

@ -124,11 +124,7 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
primary-outline
@click="closeModal"
:disabled="status != null && status != 'loading' && status?.status != 'failed'"
>
abbrechen abbrechen
</button> </button>
</div> </div>
@ -194,6 +190,7 @@ export default defineComponent({
location: formData.location.value, location: formData.location.value,
allDay: this.allDay, allDay: this.allDay,
}; };
this.status = "loading";
this.createCalendar(createCalendar) this.createCalendar(createCalendar)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -38,7 +38,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -78,6 +80,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useCalendarStore, ["deleteCalendar"]), ...mapActions(useCalendarStore, ["deleteCalendar"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteCalendar(this.data) this.deleteCalendar(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -166,11 +166,7 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
primary-outline
@click="closeModal"
:disabled="status != null && status != 'loading' && status?.status != 'failed'"
>
abbrechen / schließen abbrechen / schließen
</button> </button>
</div> </div>
@ -264,6 +260,7 @@ export default defineComponent({
location: formData.location.value, location: formData.location.value,
allDay: this.calendar.allDay, allDay: this.calendar.allDay,
}; };
this.status = "loading";
this.updateCalendar(updateCalendar) this.updateCalendar(updateCalendar)
.then(() => { .then(() => {
this.fetchItem(); this.fetchItem();

View file

@ -133,6 +133,7 @@ export default defineComponent({
birthdate: formData.birthdate.value, birthdate: formData.birthdate.value,
internalId: formData.internalId.value, internalId: formData.internalId.value,
}; };
this.status = "loading";
this.createMember(createMember) this.createMember(createMember)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -72,6 +72,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useMemberStore, ["deleteMember"]), ...mapActions(useMemberStore, ["deleteMember"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteMember(this.data) this.deleteMember(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -140,6 +140,7 @@ export default defineComponent({
given: formData.given.checked, given: formData.given.checked,
awardId: this.selectedAward.id, awardId: this.selectedAward.id,
}; };
this.status = "loading";
this.createMemberAward(createMemberAward) this.createMemberAward(createMemberAward)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -65,6 +65,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useMemberAwardStore, ["deleteMemberAward"]), ...mapActions(useMemberAwardStore, ["deleteMemberAward"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteMemberAward(this.data) this.deleteMemberAward(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -83,7 +83,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">schließen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
schließen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -167,6 +169,7 @@ export default defineComponent({
given: formData.given.checked, given: formData.given.checked,
awardId: this.memberAward.awardId, awardId: this.memberAward.awardId,
}; };
this.status = "loading";
this.updateMemberAward(updateMemberAward) this.updateMemberAward(updateMemberAward)
.then(() => { .then(() => {
this.fetchItem(); this.fetchItem();

View file

@ -175,6 +175,7 @@ export default defineComponent({
isSMSAlarming: formData.isSMSAlarming?.checked, isSMSAlarming: formData.isSMSAlarming?.checked,
typeId: this.selectedCommunicationType.id, typeId: this.selectedCommunicationType.id,
}; };
this.status = "loading";
this.createCommunication(createCommunication) this.createCommunication(createCommunication)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -68,6 +68,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useCommunicationStore, ["deleteCommunication"]), ...mapActions(useCommunicationStore, ["deleteCommunication"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteCommunication(this.data) this.deleteCommunication(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -62,7 +62,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">schließen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
schließen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -144,6 +146,7 @@ export default defineComponent({
isNewsletterMain: formData.isNewsletterMain.checked, isNewsletterMain: formData.isNewsletterMain.checked,
isSMSAlarming: formData.isSMSAlarming?.checked, isSMSAlarming: formData.isSMSAlarming?.checked,
}; };
this.status = "loading";
this.updateCommunication(updateCommunication) this.updateCommunication(updateCommunication)
.then(() => { .then(() => {
this.fetchItem(); this.fetchItem();

View file

@ -141,6 +141,7 @@ export default defineComponent({
note: formData.note.value, note: formData.note.value,
executivePositionId: this.selectedExecutivePosition.id, executivePositionId: this.selectedExecutivePosition.id,
}; };
this.status = "loading";
this.createMemberExecutivePosition(createMemberExecutivePosition) this.createMemberExecutivePosition(createMemberExecutivePosition)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -65,6 +65,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useMemberExecutivePositionStore, ["deleteMemberExecutivePosition"]), ...mapActions(useMemberExecutivePositionStore, ["deleteMemberExecutivePosition"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteMemberExecutivePosition(this.data) this.deleteMemberExecutivePosition(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -89,7 +89,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">schließen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
schließen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -176,6 +178,7 @@ export default defineComponent({
note: formData.note.value, note: formData.note.value,
executivePositionId: this.memberExecutivePosition.executivePositionId, executivePositionId: this.memberExecutivePosition.executivePositionId,
}; };
this.status = "loading";
this.updateMemberExecutivePosition(updateMemberExecutivePosition) this.updateMemberExecutivePosition(updateMemberExecutivePosition)
.then(() => { .then(() => {
this.fetchItem(); this.fetchItem();

View file

@ -148,6 +148,7 @@ export default defineComponent({
note: formData.note.value, note: formData.note.value,
qualificationId: this.selectedQualification.id, qualificationId: this.selectedQualification.id,
}; };
this.status = "loading";
this.createMemberQualification(createMemberQualification) this.createMemberQualification(createMemberQualification)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -69,6 +69,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useMemberQualificationStore, ["deleteMemberQualification"]), ...mapActions(useMemberQualificationStore, ["deleteMemberQualification"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteMemberQualification(this.data) this.deleteMemberQualification(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -90,7 +90,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">schließen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
schließen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -175,6 +177,7 @@ export default defineComponent({
terminationReason: formData.terminationReason.value, terminationReason: formData.terminationReason.value,
qualificationId: this.memberQualification.qualificationId, qualificationId: this.memberQualification.qualificationId,
}; };
this.status = "loading";
this.updateMemberQualification(updateMemberQualification) this.updateMemberQualification(updateMemberQualification)
.then(() => { .then(() => {
this.fetchItem(); this.fetchItem();

View file

@ -131,6 +131,7 @@ export default defineComponent({
start: formData.start.value, start: formData.start.value,
statusId: this.selectedStatus.id, statusId: this.selectedStatus.id,
}; };
this.status = "loading";
this.createMembership(createMember) this.createMembership(createMember)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -67,6 +67,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useMembershipStore, ["deleteMembership"]), ...mapActions(useMembershipStore, ["deleteMembership"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteMembership(this.data) this.deleteMembership(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -86,7 +86,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">schließen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
schließen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -170,6 +172,7 @@ export default defineComponent({
terminationReason: formData.terminationReason.value, terminationReason: formData.terminationReason.value,
statusId: this.membership.statusId, statusId: this.membership.statusId,
}; };
this.status = "loading";
this.updateMembership(updateMembership) this.updateMembership(updateMembership)
.then(() => { .then(() => {
this.fetchItem(); this.fetchItem();

View file

@ -61,6 +61,7 @@ export default defineComponent({
let createNewsletter: CreateNewsletterViewModel = { let createNewsletter: CreateNewsletterViewModel = {
title: formData.title.value, title: formData.title.value,
}; };
this.status = "loading";
this.createNewsletter(createNewsletter) this.createNewsletter(createNewsletter)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -64,6 +64,7 @@ export default defineComponent({
title: formData.title.value, title: formData.title.value,
date: formData.date.value, date: formData.date.value,
}; };
this.status = "loading";
this.createProtocol(createProtocol) this.createProtocol(createProtocol)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -19,7 +19,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -57,6 +59,7 @@ export default defineComponent({
let createAward: CreateAwardViewModel = { let createAward: CreateAwardViewModel = {
award: formData.award.value, award: formData.award.value,
}; };
this.status = "loading";
this.createAward(createAward) this.createAward(createAward)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -16,7 +16,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -57,6 +59,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useAwardStore, ["deleteAward"]), ...mapActions(useAwardStore, ["deleteAward"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteAward(this.data) this.deleteAward(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -32,11 +32,7 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
primary-outline
@click="closeModal"
:disabled="status != null && status != 'loading' && status?.status != 'failed'"
>
abbrechen abbrechen
</button> </button>
</div> </div>
@ -82,6 +78,7 @@ export default defineComponent({
nscdr: formData.nscdr.checked, nscdr: formData.nscdr.checked,
passphrase: formData.passphrase.value, passphrase: formData.passphrase.value,
}; };
this.status = "loading";
this.createCalendarType(createCalendarType) this.createCalendarType(createCalendarType)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -16,7 +16,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -56,6 +58,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useCalendarTypeStore, ["deleteCalendarType"]), ...mapActions(useCalendarTypeStore, ["deleteCalendarType"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteCalendarType(this.data) this.deleteCalendarType(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -65,7 +65,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -114,6 +116,7 @@ export default defineComponent({
type: formData.communicationType.value, type: formData.communicationType.value,
fields: this.selectedFields, fields: this.selectedFields,
}; };
this.status = "loading";
this.createCommunicationType(createCommunicationType) this.createCommunicationType(createCommunicationType)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -16,7 +16,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -56,6 +58,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useCommunicationTypeStore, ["deleteCommunicationType"]), ...mapActions(useCommunicationTypeStore, ["deleteCommunicationType"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteCommunicationType(this.data) this.deleteCommunicationType(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -19,7 +19,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -57,6 +59,7 @@ export default defineComponent({
let createExecutivePosition: CreateExecutivePositionViewModel = { let createExecutivePosition: CreateExecutivePositionViewModel = {
position: formData.executivePosition.value, position: formData.executivePosition.value,
}; };
this.status = "loading";
this.createExecutivePosition(createExecutivePosition) this.createExecutivePosition(createExecutivePosition)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -16,7 +16,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -57,6 +59,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useExecutivePositionStore, ["deleteExecutivePosition"]), ...mapActions(useExecutivePositionStore, ["deleteExecutivePosition"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteExecutivePosition(this.data) this.deleteExecutivePosition(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -19,7 +19,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -57,6 +59,7 @@ export default defineComponent({
let createMembershipStatus: CreateMembershipStatusViewModel = { let createMembershipStatus: CreateMembershipStatusViewModel = {
status: formData.membershipStatus.value, status: formData.membershipStatus.value,
}; };
this.status = "loading";
this.createMembershipStatus(createMembershipStatus) this.createMembershipStatus(createMembershipStatus)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -16,7 +16,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -57,6 +59,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useMembershipStatusStore, ["deleteMembershipStatus"]), ...mapActions(useMembershipStatusStore, ["deleteMembershipStatus"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteMembershipStatus(this.data) this.deleteMembershipStatus(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -23,7 +23,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -62,6 +64,7 @@ export default defineComponent({
qualification: formData.qualification.value, qualification: formData.qualification.value,
description: formData.description.value, description: formData.description.value,
}; };
this.status = "loading";
this.createQualification(createQualification) this.createQualification(createQualification)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -16,7 +16,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -57,6 +59,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useQualificationStore, ["deleteQualification"]), ...mapActions(useQualificationStore, ["deleteQualification"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteQualification(this.data) this.deleteQualification(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -19,7 +19,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -62,6 +64,7 @@ export default defineComponent({
title: formData.title.value, title: formData.title.value,
query: this.query ?? "", query: this.query ?? "",
}; };
this.status = "loading";
this.createQueryStore(createAward) this.createQueryStore(createAward)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -16,7 +16,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -56,6 +58,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useQueryStoreStore, ["deleteQueryStore"]), ...mapActions(useQueryStoreStore, ["deleteQueryStore"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteQueryStore(this.data) this.deleteQueryStore(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -21,7 +21,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -73,6 +75,7 @@ export default defineComponent({
id: this.data, id: this.data,
query: this.query ?? "", query: this.query ?? "",
}; };
this.status = "loading";
this.updateActiveQueryStore(updateQuery) this.updateActiveQueryStore(updateQuery)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -23,7 +23,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -62,6 +64,7 @@ export default defineComponent({
template: formData.template.value, template: formData.template.value,
description: formData.description.value, description: formData.description.value,
}; };
this.status = "loading";
this.createTemplate(createTemplate) this.createTemplate(createTemplate)
.then((res) => { .then((res) => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -16,7 +16,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -57,6 +59,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useTemplateStore, ["deleteTemplate"]), ...mapActions(useTemplateStore, ["deleteTemplate"]),
triggerDelete() { triggerDelete() {
this.status = "loading";
this.deleteTemplate(this.data) this.deleteTemplate(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -19,7 +19,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -53,6 +55,7 @@ export default defineComponent({
...mapActions(useRoleStore, ["createRole"]), ...mapActions(useRoleStore, ["createRole"]),
triggerCreateRole(e: any) { triggerCreateRole(e: any) {
let formData = e.target.elements; let formData = e.target.elements;
this.status = "loading";
this.createRole(formData.role.value) this.createRole(formData.role.value)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -16,7 +16,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -56,6 +58,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useRoleStore, ["deleteRole"]), ...mapActions(useRoleStore, ["deleteRole"]),
triggerDeleteRole() { triggerDeleteRole() {
this.status = "loading";
this.deleteRole(this.data) this.deleteRole(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -16,7 +16,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -56,6 +58,7 @@ export default defineComponent({
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useUserStore, ["deleteUser"]), ...mapActions(useUserStore, ["deleteUser"]),
triggerDeleteUser() { triggerDeleteUser() {
this.status = "loading";
this.deleteUser(this.data) this.deleteUser(this.data)
.then(() => { .then(() => {
this.status = { status: "success" }; this.status = { status: "success" };

View file

@ -32,7 +32,9 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2"> <div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button> <button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
abbrechen
</button>
</div> </div>
</div> </div>
</div> </div>
@ -70,13 +72,13 @@ export default defineComponent({
...mapActions(useInviteStore, ["createInvite"]), ...mapActions(useInviteStore, ["createInvite"]),
invite(e: any) { invite(e: any) {
let formData = e.target.elements; let formData = e.target.elements;
this.status = "loading";
let createInvite: CreateInviteViewModel = { let createInvite: CreateInviteViewModel = {
username: formData.username.value, username: formData.username.value,
mail: formData.mail.value, mail: formData.mail.value,
firstname: formData.firstname.value, firstname: formData.firstname.value,
lastname: formData.lastname.value, lastname: formData.lastname.value,
}; };
this.status = "loading";
this.createInvite(createInvite) this.createInvite(createInvite)
.then((result) => { .then((result) => {
this.status = { status: "success" }; this.status = { status: "success" };
@ -86,7 +88,7 @@ export default defineComponent({
}) })
.catch((err) => { .catch((err) => {
this.status = { status: "failed", reason: err.response.data }; this.status = { status: "failed", reason: err.response.data };
}) });
}, },
}, },
}); });

View file

@ -66,7 +66,11 @@ http.interceptors.response.use(
} }
const notificationStore = useNotificationStore(); const notificationStore = useNotificationStore();
if (error.toString().includes("Network Error")) {
notificationStore.push("Netzwerkfehler", "Server nicht erreichbar!", "error");
} else {
notificationStore.push("Fehler", error.response.data, "error"); notificationStore.push("Fehler", error.response.data, "error");
}
return Promise.reject(error); return Promise.reject(error);
} }