File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,11 +27,7 @@ def create
2727 if @project . save
2828 redirect_to @project , notice : "Project created successfully!"
2929 else
30- redirect_to new_project_path , inertia : {
31- errors : @project . errors . to_hash ( true ) ,
32- currency_options : Project . currency_options_for_select ,
33- user_preferred_currency : Current . user . preferred_currency
34- }
30+ redirect_to new_project_path , inertia : { errors : @project . errors . as_json }
3531 end
3632 end
3733
@@ -46,9 +42,8 @@ def update
4642 if @project . update ( project_params )
4743 redirect_to @project , notice : "Project updated successfully!"
4844 else
49- redirect_to edit_project_path ( @project ) , inertia : {
50- errors : @project . errors . to_hash ( true ) ,
51- currency_options : Project . currency_options_for_select
45+ redirect_to edit_project_path ( @project ) , inertia : {
46+ errors : @project . errors . as_json
5247 }
5348 end
5449 end
Original file line number Diff line number Diff line change 3434
3535 let errors = $page .props .errors || {};
3636 let isSubmitting = false ;
37+
38+ // Reactively update errors when page props change
39+ $: errors = $page .props .errors || {};
3740
3841 function handleSubmit () {
3942 if (isSubmitting) return ;
You can’t perform that action at this time.
0 commit comments