Skip to content

Commit

Permalink
fix error handeling
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghelupu17 committed Oct 17, 2023
1 parent ad80a7e commit 139bafd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/Dashboard/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function update(Request $request, Project $project)
{
$this->authorize('editAsNgo', $project);
ProjectService::update($project, $request->all());

return redirect()->back()
->with('success', 'Project updated.');
}
Expand Down
1 change: 1 addition & 0 deletions resources/js/Components/RepeaterComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const props = defineProps({
console.log(props.elements);
const tmpElements = ref(props.elements);
console.log(tmpElements.value);
emit('upload', tmpElements);
Expand Down
22 changes: 20 additions & 2 deletions resources/js/Pages/AdminOng/Projects/EditProject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@
@click="changeProjectStatus(project.id, 'pending', project.type)"
:label="$t('publish')"
/>

</dl>
</DashboardLayout>
</template>
Expand Down Expand Up @@ -487,7 +486,26 @@ const changeProjectStatus = (id, status, type) => {
let tmpRoute =
type === 'regional' ? route('dashboard.projects.regional.status', id) : route('dashboard.projects.status', id);
if (confirm('Are you sure you want to change the status of this project?')) {
formChangeStatus.post(tmpRoute);
formChangeStatus.post(tmpRoute, {
preserveScroll: true,
onSuccess: (response) => {
//
},
onError: (error) => {
Object.keys(error).forEach((key) => {
if (key.includes('external_links'))
{
formChangeStatus.errors['external_links'] = error[key];
}
if (key.includes('videos'))
{
formChangeStatus.errors['videos'] = error[key];
}
});
console.log(error)
},
});
}
};
Expand Down

0 comments on commit 139bafd

Please sign in to comment.