From 15b2eecb86034de46934276610221b9592011e07 Mon Sep 17 00:00:00 2001 From: bb1950328 Date: Sat, 11 May 2024 23:53:44 +0200 Subject: [PATCH] replace hard coded api urls with templated links fixes #977 --- .../campAdmin/DialogActivityProgressLabelCreate.vue | 7 ++++++- frontend/src/components/campAdmin/DialogCategoryCreate.vue | 5 ++++- .../src/components/campAdmin/DialogMaterialListCreate.vue | 5 ++++- frontend/src/components/campAdmin/DialogPeriodCreate.vue | 5 ++++- .../src/components/collaborator/CollaboratorCreate.vue | 7 ++++++- frontend/src/components/collaborator/CollaboratorEdit.vue | 7 ++++++- frontend/src/components/program/DialogActivityCreate.vue | 5 ++++- 7 files changed, 34 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/campAdmin/DialogActivityProgressLabelCreate.vue b/frontend/src/components/campAdmin/DialogActivityProgressLabelCreate.vue index cdbaa9d6ef..86cbb2dba9 100644 --- a/frontend/src/components/campAdmin/DialogActivityProgressLabelCreate.vue +++ b/frontend/src/components/campAdmin/DialogActivityProgressLabelCreate.vue @@ -33,7 +33,7 @@ export default { data() { return { entityProperties: ['camp', 'position', 'title'], - entityUri: '/activity_progress_labels', + entityUri: '', } }, watch: { @@ -53,6 +53,11 @@ export default { } }, }, + mounted() { + this.api + .href(this.api.get(), 'activityProgressLabels') + .then((uri) => (this.entityUri = uri)) + }, methods: { createDialogActivityProgressLabelCreate() { return this.create().then(() => { diff --git a/frontend/src/components/campAdmin/DialogCategoryCreate.vue b/frontend/src/components/campAdmin/DialogCategoryCreate.vue index 3470e5541b..fab2603455 100644 --- a/frontend/src/components/campAdmin/DialogCategoryCreate.vue +++ b/frontend/src/components/campAdmin/DialogCategoryCreate.vue @@ -126,7 +126,7 @@ export default { return { entityProperties: ['camp', 'short', 'name', 'color', 'numberingStyle'], embeddedCollections: ['preferredContentTypes'], - entityUri: '/categories', + entityUri: '', clipboardPermission: 'unknown', copyCategorySource: null, copyCategorySourceUrl: null, @@ -224,6 +224,9 @@ export default { ) }, }, + mounted() { + this.api.href(this.api.get(), 'categories').then((uri) => (this.entityUri = uri)) + }, methods: { async createCategory() { const createdCategory = await this.create() diff --git a/frontend/src/components/campAdmin/DialogMaterialListCreate.vue b/frontend/src/components/campAdmin/DialogMaterialListCreate.vue index 0cd4e1400e..3d07a8fd8f 100644 --- a/frontend/src/components/campAdmin/DialogMaterialListCreate.vue +++ b/frontend/src/components/campAdmin/DialogMaterialListCreate.vue @@ -33,7 +33,7 @@ export default { data() { return { entityProperties: ['camp', 'name'], - entityUri: '/material_lists', + entityUri: '', } }, watch: { @@ -49,6 +49,9 @@ export default { } }, }, + mounted() { + this.api.href(this.api.get(), 'materialLists').then((uri) => (this.entityUri = uri)) + }, methods: { createMaterialList() { return this.create().then(() => { diff --git a/frontend/src/components/campAdmin/DialogPeriodCreate.vue b/frontend/src/components/campAdmin/DialogPeriodCreate.vue index 0cfde52709..a82940ca20 100644 --- a/frontend/src/components/campAdmin/DialogPeriodCreate.vue +++ b/frontend/src/components/campAdmin/DialogPeriodCreate.vue @@ -32,7 +32,7 @@ export default { data() { return { entityProperties: ['camp', 'description', 'start', 'end'], - entityUri: '/periods', + entityUri: '', } }, watch: { @@ -50,6 +50,9 @@ export default { } }, }, + mounted() { + this.api.href(this.api.get(), 'periods').then((uri) => (this.entityUri = uri)) + }, methods: { createPeriod() { return this.create().then(() => { diff --git a/frontend/src/components/collaborator/CollaboratorCreate.vue b/frontend/src/components/collaborator/CollaboratorCreate.vue index d5390500ca..ba303341be 100644 --- a/frontend/src/components/collaborator/CollaboratorCreate.vue +++ b/frontend/src/components/collaborator/CollaboratorCreate.vue @@ -52,7 +52,7 @@ export default { data() { return { entityProperties: ['camp', 'inviteEmail', 'role'], - entityUri: '/camp_collaborations', + entityUri: '', } }, watch: { @@ -69,6 +69,11 @@ export default { } }, }, + mounted() { + this.api + .href(this.api.get(), 'campCollaborations') + .then((uri) => (this.entityUri = uri)) + }, methods: { createCollaboration() { return this.create().then(() => { diff --git a/frontend/src/components/collaborator/CollaboratorEdit.vue b/frontend/src/components/collaborator/CollaboratorEdit.vue index 89a43273df..7484fe53d3 100644 --- a/frontend/src/components/collaborator/CollaboratorEdit.vue +++ b/frontend/src/components/collaborator/CollaboratorEdit.vue @@ -153,7 +153,7 @@ export default { resendingEmail: false, emailSent: false, entityProperties: ['camp', 'inviteEmail', 'role', 'status'], - entityUri: '/camp_collaborations', + entityUri: '', } }, computed: { @@ -195,6 +195,11 @@ export default { } }, }, + mounted() { + this.api + .href(this.api.get(), 'campCollaborations') + .then((uri) => (this.entityUri = uri)) + }, methods: { resendInvitation() { this.emailSent = true diff --git a/frontend/src/components/program/DialogActivityCreate.vue b/frontend/src/components/program/DialogActivityCreate.vue index 1f4d56f053..142cad3a6e 100644 --- a/frontend/src/components/program/DialogActivityCreate.vue +++ b/frontend/src/components/program/DialogActivityCreate.vue @@ -138,7 +138,7 @@ export default { copyActivitySourceUrlShowPopover: false, entityProperties: ['title', 'location', 'scheduleEntries'], embeddedEntities: ['category'], - entityUri: '/activities', + entityUri: '', } }, computed: { @@ -247,6 +247,9 @@ export default { ) }, }, + mounted() { + this.api.href(this.api.get(), 'activities').then((url) => (this.entityUri = url)) + }, methods: { refreshCopyActivitySource() { navigator.permissions.query({ name: 'clipboard-read' }).then(