Skip to content

Commit

Permalink
Merge d871e55 into 459684a
Browse files Browse the repository at this point in the history
  • Loading branch information
Dantemss committed Mar 29, 2017
2 parents 459684a + d871e55 commit 75de878
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions exercises/src/api/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ start = ->
)

connectDelete(ExerciseActions, {trigger: 'deleteAttachment', onSuccess: 'attachmentDeleted'},
(exerciseUid, attachmentId) -> url: "/api/exercises/#{exerciseUid}/attachments/#{attachmentId}"
(exerciseId, attachmentId) ->
id = getIdOnly(exerciseId)
url: "exercises/#{id}@draft/attachments/#{attachmentId}"
)

connectRead(VocabularyActions, (id) -> url: "vocab_terms/#{getIdWithVersion(id, 'draft')}")
Expand All @@ -53,8 +55,9 @@ start = ->

CSRF_TOKEN = document.head.querySelector('meta[name=csrf-token]')?.getAttribute("content")

uploadExerciseImage = (exerciseUid, image, cb) ->
url = "/api/exercises/#{exerciseUid}/attachments"
uploadExerciseImage = (exerciseId, image, cb) ->
id = getIdOnly(exerciseId)
url = "/api/exercises/#{id}@draft/attachments"
xhr = new XMLHttpRequest()
xhr.addEventListener 'load', (req) ->
cb(if req.currentTarget.status is 201
Expand Down

0 comments on commit 75de878

Please sign in to comment.