From d14a21e84a247e4bc15bd2a9733dbbdd48a7bb51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr> Date: Wed, 25 Aug 2021 17:34:08 +0200 Subject: [PATCH] Fix undefineddata from api replacing mocks --- .../feature_type/Feature_type_detail.vue | 13 +++++-- src/views/project/Project_edit.vue | 35 +++++++++---------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/views/feature_type/Feature_type_detail.vue b/src/views/feature_type/Feature_type_detail.vue index b0944ced..86f7328e 100644 --- a/src/views/feature_type/Feature_type_detail.vue +++ b/src/views/feature_type/Feature_type_detail.vue @@ -3,7 +3,7 @@ <h1>{{ feature_type_slug }}</h1> {{ feature_type }} </div> --> - <div class="row"> + <div v-if="structure" class="row"> <div class="five wide column"> <div class="ui attached secondary segment"> <h1 class="ui center aligned header"> @@ -163,7 +163,7 @@ <router-link :to="{ name: 'ajouter-signalement', - params: { slug_type_signal: structure.title }, + params: { slug_type_signal: structure.slug }, }" class="ui icon button button-hover-green" > @@ -196,6 +196,14 @@ export default { }, }, + watch: { + structure(newVal, oldVal) { + if (newVal !== oldVal) { + this.getImports(); + } + }, + }, + data() { return { filenameToImport: { @@ -274,7 +282,6 @@ export default { "feature_type/SET_CURRENT_FEATURE_TYPE_SLUG", this.$route.params.slug_type_signal ); - this.getImports(); }, }; </script> \ No newline at end of file diff --git a/src/views/project/Project_edit.vue b/src/views/project/Project_edit.vue index c09c7002..0d512063 100644 --- a/src/views/project/Project_edit.vue +++ b/src/views/project/Project_edit.vue @@ -4,7 +4,7 @@ <h1> <span v-if="action === 'edit'" >Édition du projet "{{ form.title }}"</span - ><!-- // todo : [pour UPDATE] récupérer project à éditer --> + > <span v-else-if="action === 'create'">Création d'un projet</span> </h1> @@ -183,25 +183,24 @@ export default { "Contributeur", ], form: { - title: "Vuetification (Copie-23/07/2021 09:19)", - slug: "6-vuetification-copie-23072021-0919", - created_on: "23/07/2021", - updated_on: "29/07/2021", - description: - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", - moderation: true, - thumbnail: "http://localhost:8000/media/user_1/albinoscom.jpg", - thumbnail_name: "albinoscom", // todo: delete after getting image in jpg or png instead of data64 (require post to django) - creator: 1, - access_level_pub_feature: "Utilisateur anonyme", - access_level_arch_feature: "Utilisateur anonyme", + title: "", + slug: "", + created_on: "", + updated_on: "", + description: "", + moderation: false, + thumbnail: "https://via.placeholder.com/150", // todo : utiliser l'image par défaut + thumbnail_name: "", // todo: delete after getting image in jpg or png instead of data64 (require post to django) + creator: null, + access_level_pub_feature: "", + access_level_arch_feature: "", archive_feature: 0, delete_feature: 0, - nb_features: 2, - nb_published_features: 1, + nb_features: 0, + nb_published_features: 0, nb_comments: 0, nb_published_features_comments: 0, - nb_contributors: 2, + nb_contributors: 0, is_project_type: false, }, }; @@ -210,7 +209,7 @@ export default { computed: { ...mapGetters(["project"]), }, -/* + /* watch: { project(newValue, oldValue) { console.log("watch", newValue); @@ -272,7 +271,7 @@ export default { }, created() { this.definePageType(); - if (this.action === "edit") { + if (this.action !== "create") { if (!this.project) { this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug); this.form = this.project; -- GitLab