Skip to content

Commit

Permalink
fix: fix quick facts not being able to be saved (#6912)
Browse files Browse the repository at this point in the history
  • Loading branch information
djaiss authored Oct 2, 2023
1 parent 2cb7508 commit b6b78e5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]),
],
];
}

Expand Down
6 changes: 2 additions & 4 deletions resources/js/Shared/Modules/QuickFacts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
});
};
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit b6b78e5

Please sign in to comment.