From 203c2c03ce649f54ee990489d9ac231f5bac0eda Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Tue, 07 Jan 2025 18:26:30 +0100 Subject: [PATCH] Deleting Items --- 10 - course project/xno-prj-cmp-01-starting-setup/src/components/learning-resource/AddResource.vue | 4 ++-- 10 - course project/xno-prj-cmp-01-starting-setup/src/components/learning-resource/TheResources.vue | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/10 - course project/xno-prj-cmp-01-starting-setup/src/components/learning-resource/AddResource.vue b/10 - course project/xno-prj-cmp-01-starting-setup/src/components/learning-resource/AddResource.vue index 5ddea32..e57d5db 100644 --- a/10 - course project/xno-prj-cmp-01-starting-setup/src/components/learning-resource/AddResource.vue +++ b/10 - course project/xno-prj-cmp-01-starting-setup/src/components/learning-resource/AddResource.vue @@ -51,8 +51,8 @@ if ( enteredTitle.trim() === '' || - enteredDescription.trim() || - enteredUrl.trim() + enteredDescription.trim() === '' || + enteredUrl.trim() === '' ) { this.inputIsInvalid = true; return; diff --git a/10 - course project/xno-prj-cmp-01-starting-setup/src/components/learning-resource/TheResources.vue b/10 - course project/xno-prj-cmp-01-starting-setup/src/components/learning-resource/TheResources.vue index 0e1aec5..8afc81b 100644 --- a/10 - course project/xno-prj-cmp-01-starting-setup/src/components/learning-resource/TheResources.vue +++ b/10 - course project/xno-prj-cmp-01-starting-setup/src/components/learning-resource/TheResources.vue @@ -75,10 +75,10 @@ this.selectedTab = 'stored-resources'; }, removeResource(resId) { - this.storedResouces = this.storedResouces.filter( - (res) => res.id !== resId + const resIndex = this.storedResouces.findIndex( + (res) => res.id === resId ); - console.log(this.storedResouces.length); + this.storedResouces.splice(resIndex, 1); }, }, }; -- Gitblit v1.8.0