cancel changes
sometimes resets new entry
This commit is contained in:
parent
0dd5ad09a8
commit
5e50b85631
21 changed files with 193 additions and 53 deletions
|
@ -61,13 +61,15 @@ export const useAwardStore = defineStore("award", {
|
|||
},
|
||||
updateActiveAward(award: CreateOrUpdateAwardViewModel) {
|
||||
if (this.award == null) return;
|
||||
let id = this.award.id;
|
||||
this.updateStatus = "loading";
|
||||
http
|
||||
.patch(`/admin/award/${this.award.id}`, {
|
||||
.patch(`/admin/award/${id}`, {
|
||||
award: award.award,
|
||||
})
|
||||
.then((result) => {
|
||||
this.updateStatus = { status: "success" };
|
||||
this.fetchAwardById(id);
|
||||
this.fetchAwards();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -79,14 +79,16 @@ export const useCommunicationTypeStore = defineStore("communicationType", {
|
|||
},
|
||||
updateActiveCommunicationType(communicationType: CreateOrUpdateCommunicationTypeViewModel) {
|
||||
if (this.communicationType == null) return;
|
||||
let id = this.communicationType.id;
|
||||
this.updateStatus = "loading";
|
||||
http
|
||||
.patch(`/admin/communicationType/${this.communicationType.id}`, {
|
||||
.patch(`/admin/communicationType/${id}`, {
|
||||
communicationType: communicationType.type,
|
||||
fields: communicationType.fields,
|
||||
})
|
||||
.then((result) => {
|
||||
this.updateStatus = { status: "success" };
|
||||
this.fetchCommunicationTypeById(id);
|
||||
this.fetchCommunicationTypes();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -64,13 +64,15 @@ export const useExecutivePositionStore = defineStore("executivePosition", {
|
|||
},
|
||||
updateActiveExecutivePosition(executivePosition: CreateOrUpdateExecutivePositionViewModel) {
|
||||
if (this.executivePosition == null) return;
|
||||
let id = this.executivePosition.id;
|
||||
this.updateStatus = "loading";
|
||||
http
|
||||
.patch(`/admin/executivePosition/${this.executivePosition.id}`, {
|
||||
.patch(`/admin/executivePosition/${id}`, {
|
||||
executivePosition: executivePosition.position,
|
||||
})
|
||||
.then((result) => {
|
||||
this.updateStatus = { status: "success" };
|
||||
this.fetchExecutivePositionById(id);
|
||||
this.fetchExecutivePositions();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -64,13 +64,15 @@ export const useMembershipStatusStore = defineStore("membershipStatus", {
|
|||
},
|
||||
updateActiveMembershipStatus(membershipStatus: CreateOrUpdateMembershipStatusViewModel) {
|
||||
if (this.membershipStatus == null) return;
|
||||
let id = this.membershipStatus.id;
|
||||
this.updateStatus = "loading";
|
||||
http
|
||||
.patch(`/admin/membershipStatus/${this.membershipStatus.id}`, {
|
||||
.patch(`/admin/membershipStatus/${id}`, {
|
||||
membershipStatus: membershipStatus.status,
|
||||
})
|
||||
.then((result) => {
|
||||
this.updateStatus = { status: "success" };
|
||||
this.fetchMembershipStatusById(id);
|
||||
this.fetchMembershipStatuss();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -65,14 +65,16 @@ export const useQualificationStore = defineStore("qualification", {
|
|||
},
|
||||
updateActiveQualification(qualification: CreateOrUpdateQualificationViewModel) {
|
||||
if (this.qualification == null) return;
|
||||
let id = this.qualification.id;
|
||||
this.updateStatus = "loading";
|
||||
http
|
||||
.patch(`/admin/qualification/${this.qualification.id}`, {
|
||||
.patch(`/admin/qualification/${id}`, {
|
||||
qualification: qualification.qualification,
|
||||
description: qualification.description,
|
||||
})
|
||||
.then((result) => {
|
||||
this.updateStatus = { status: "success" };
|
||||
this.fetchQualificationById(id);
|
||||
this.fetchQualifications();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -62,13 +62,15 @@ export const useRoleStore = defineStore("role", {
|
|||
},
|
||||
updateActiveRole(role: string) {
|
||||
if (this.role == null) return;
|
||||
let id = this.role.id;
|
||||
this.updateStatus = "loading";
|
||||
http
|
||||
.patch(`/admin/role/${this.role.id}`, {
|
||||
.patch(`/admin/role/${id}`, {
|
||||
role: role,
|
||||
})
|
||||
.then((result) => {
|
||||
this.updateStatus = { status: "success" };
|
||||
this.fetchRoleById(id);
|
||||
this.fetchRoles();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
@ -77,13 +79,15 @@ export const useRoleStore = defineStore("role", {
|
|||
},
|
||||
updateActiveRolePermissions(permission: PermissionObject) {
|
||||
if (this.role == null) return;
|
||||
let id = this.role.id;
|
||||
this.updateStatus = "loading";
|
||||
http
|
||||
.patch(`/admin/role/${this.role.id}/permissions`, {
|
||||
.patch(`/admin/role/${id}/permissions`, {
|
||||
permissions: permission,
|
||||
})
|
||||
.then((result) => {
|
||||
this.updateStatus = { status: "success" };
|
||||
this.fetchRoleById(id);
|
||||
this.fetchRoles();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -48,9 +48,10 @@ export const useUserStore = defineStore("user", {
|
|||
},
|
||||
updateActiveUser(user: CreateOrUpdateUserViewModel) {
|
||||
if (this.user == null) return;
|
||||
let id = this.user.id;
|
||||
this.updateStatus = "loading";
|
||||
http
|
||||
.patch(`/admin/user/${this.user.id}`, {
|
||||
.patch(`/admin/user/${id}`, {
|
||||
username: user.username,
|
||||
firstname: user.firstname,
|
||||
lastname: user.lastname,
|
||||
|
@ -58,6 +59,7 @@ export const useUserStore = defineStore("user", {
|
|||
})
|
||||
.then((result) => {
|
||||
this.updateStatus = { status: "success" };
|
||||
this.fetchUserById(id);
|
||||
this.fetchUsers();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
@ -66,13 +68,15 @@ export const useUserStore = defineStore("user", {
|
|||
},
|
||||
updateActiveUserPermissions(permission: PermissionObject) {
|
||||
if (this.user == null) return;
|
||||
let id = this.user.id;
|
||||
this.updateStatus = "loading";
|
||||
http
|
||||
.patch(`/admin/user/${this.user.id}/permissions`, {
|
||||
.patch(`/admin/user/${id}/permissions`, {
|
||||
permissions: permission,
|
||||
})
|
||||
.then((result) => {
|
||||
this.updateStatus = { status: "success" };
|
||||
this.fetchUserById(id);
|
||||
this.fetchUsers();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
@ -81,13 +85,15 @@ export const useUserStore = defineStore("user", {
|
|||
},
|
||||
updateActiveUserRoles(roles: Array<number>) {
|
||||
if (this.user == null) return;
|
||||
let id = this.user.id;
|
||||
this.updateStatus = "loading";
|
||||
http
|
||||
.patch(`/admin/user/${this.user.id}/roles`, {
|
||||
.patch(`/admin/user/${id}/roles`, {
|
||||
roleIds: roles,
|
||||
})
|
||||
.then((result) => {
|
||||
this.updateStatus = { status: "success" };
|
||||
this.fetchUserById(id);
|
||||
this.fetchUsers();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue