Skip to content

Commit

Permalink
Improve fix by assigning variables from event.detail
Browse files Browse the repository at this point in the history
  • Loading branch information
masaball committed Jan 12, 2024
1 parent 341b694 commit bcdd05b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/assets/javascripts/avalon_timelines/timelines.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,19 @@ $('#copy-timeline-form').submit(
)

$('#copy-timeline-form').bind('ajax:success',
(event, data, status, xhr) ->
if (data?.errors)
(event) ->
[data, status, xhr] = event.detail
if (data.errors)
console.log(data.errors.title[0])
else
if (submit_edit)
window.location.href = event.detail[0].path
window.location.href = data.path
else
if ( $('#with_refresh').val() )
location.reload()
).bind('ajax:error',
(e, xhr, status, error) ->
(event) ->
[data, status, xhr] = event.detail
console.log(xhr.responseJSON.errors)
)

Expand Down

0 comments on commit bcdd05b

Please sign in to comment.