1 | sd = require('sharify').data
|
2 |
|
3 | $ ->
|
4 | if sd.CURRENT_USER
|
5 | $('body').append "<br><br>your email from the client-side!<br> " + sd.CURRENT_USER.email
|
6 | $('[href*=sign_out]').click (e) ->
|
7 | e.preventDefault()
|
8 | $.ajax
|
9 | url: '/users/sign_out'
|
10 | type: 'DELETE'
|
11 | success: ->
|
12 | window.location = '/'
|
13 | error: (xhr, status, error) ->
|
14 | alert(error)
|
15 | $('[href*=delete]').click (e) ->
|
16 | e.preventDefault() unless confirm "Are you sure?"
|
17 | else
|
18 | $('#trust button').click ->
|
19 | $.ajax
|
20 | type: 'POST'
|
21 | url: "#{sd.ARTSY_URL}/api/v1/me/trust_token"
|
22 | headers: 'x-access-token': $('#trust input').val().trim()
|
23 | error: (e) ->
|
24 | alert 'Error!'
|
25 | console.warn e
|
26 | success: ({ trust_token }) ->
|
27 | window.location = "http://#{location.host}?trust_token=#{trust_token}"
|