diff --git a/app/Domains/Contact/ManageQuickFacts/Web/ViewHelpers/ContactModuleQuickFactViewHelper.php b/app/Domains/Contact/ManageQuickFacts/Web/ViewHelpers/ContactModuleQuickFactViewHelper.php index e5bbe18c136..23e44dd14e3 100644 --- a/app/Domains/Contact/ManageQuickFacts/Web/ViewHelpers/ContactModuleQuickFactViewHelper.php +++ b/app/Domains/Contact/ManageQuickFacts/Web/ViewHelpers/ContactModuleQuickFactViewHelper.php @@ -28,13 +28,6 @@ public static function data(Contact $contact, VaultQuickFactsTemplate $template) ], ], 'quick_facts' => $quickFacts, - 'url' => [ - 'store' => route('contact.quick_fact.store', [ - 'vault' => $contact->vault_id, - 'contact' => $contact->id, - 'template' => $template->id, - ]), - ], ]; } diff --git a/resources/js/Shared/Modules/QuickFacts.vue b/resources/js/Shared/Modules/QuickFacts.vue index b1ff70343fb..e453ef20e67 100644 --- a/resources/js/Shared/Modules/QuickFacts.vue +++ b/resources/js/Shared/Modules/QuickFacts.vue @@ -22,7 +22,6 @@ const createQuickFactModalShown = ref(false); const openState = ref(props.data.show_quick_facts); const localQuickFacts = ref(props.data.quick_facts.quick_facts); const localTemplate = ref(props.data.quick_facts.template); -const localUrl = ref(props.data.url); const contentField = ref(null); const editedQuickFactId = ref(null); @@ -48,11 +47,10 @@ const showEditQuickFactModal = (quickFact) => { const get = (template) => { loading.value = true; - localTemplate.value = template; axios.get(template.url.show).then((response) => { + localTemplate.value = response.data.data.template; localQuickFacts.value = response.data.data.quick_facts; - localUrl.value = response.data.data.url; loading.value = false; }); }; @@ -61,7 +59,7 @@ const store = () => { loadingState.value = 'loading'; axios - .post(localUrl.value.store, form) + .post(localTemplate.value.url.store, form) .then((response) => { loadingState.value = ''; createQuickFactModalShown.value = false; diff --git a/tests/Unit/Domains/Contact/ManageQuickFacts/Web/ViewHelpers/ContactModuleQuickFactViewHelperTest.php b/tests/Unit/Domains/Contact/ManageQuickFacts/Web/ViewHelpers/ContactModuleQuickFactViewHelperTest.php index 43b17262587..59d8c914dce 100644 --- a/tests/Unit/Domains/Contact/ManageQuickFacts/Web/ViewHelpers/ContactModuleQuickFactViewHelperTest.php +++ b/tests/Unit/Domains/Contact/ManageQuickFacts/Web/ViewHelpers/ContactModuleQuickFactViewHelperTest.php @@ -22,20 +22,12 @@ public function it_gets_the_data_needed_for_the_view(): void $array = ContactModuleQuickFactViewHelper::data($contact, $template); $this->assertEquals( - 3, + 2, count($array) ); $this->assertArrayHasKey('template', $array); $this->assertArrayHasKey('quick_facts', $array); - $this->assertArrayHasKey('url', $array); - - $this->assertEquals( - [ - 'store' => env('APP_URL').'/vaults/'.$contact->vault->id.'/contacts/'.$contact->id.'/quickFacts/'.$template->id, - ], - $array['url'] - ); } /** @test */