Sha256: 6a545addfbcfb9d8a56e5bc339c7714a78c10b964262c16997ddcc09c4549afe
Contents?: true
Size: 948 Bytes
Versions: 2
Compression:
Stored size: 948 Bytes
Contents
// Perform an authenticated GET to the API server. function api_get(url, username, success, error) { $.ajax({ type: 'GET', url: encodeURI(url), dataType: 'json', crossDomain: true, beforeSend: function(xhr) { var token = Cookies.get('cyclid.token'); var authorization = `Token ${username}:${token}` xhr.setRequestHeader('Authorization', authorization); }, success: success, error: error }); } // Perform an authenticated PUT to the API server. function api_put(url, data, username, success, error) { $.ajax({ type: 'PUT', url: encodeURI(url), data: JSON.stringify(data), contentType: 'application/json', crossDomain: true, beforeSend: function(xhr) { var token = Cookies.get('cyclid.token'); var authorization = `Token ${username}:${token}` xhr.setRequestHeader('Authorization', authorization); }, success: success, error: error }); }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cyclid-ui-0.1.1 | public/js/api.js |
cyclid-ui-0.1.0 | public/js/api.js |