Skip to content

Commit

Permalink
Merge pull request ManageIQ#11708 from dkorn/api_options
Browse files Browse the repository at this point in the history
miq_api - add options function
  • Loading branch information
himdel committed Oct 5, 2016
2 parents 18195e2 + f6150ec commit 03dfdf2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/assets/javascripts/miq_api.js
Expand Up @@ -5,6 +5,7 @@
* API.post(url, data, options) - returns Promise
* API.put - (the same)
* API.patch - (the same)
* API.options - (the same)
* API.login(login, password) - performs initial authentication, saves token on success, returns Promise
* API.logout() - clears login info, no return
* API.autorenew() - registers a 60second interval to query /api, returns a function to clear the interval
Expand All @@ -26,6 +27,13 @@
.then(process_response);
};

API.options = function(url, options) {
return fetch(url, _.extend({
method: 'OPTIONS',
}, process_options(options)))
.then(process_response);
};

API.post = function(url, data, options) {
return fetch(url, _.extend({
method: 'POST',
Expand Down Expand Up @@ -169,6 +177,7 @@ angular.module('miq.api', [])
delete: angularify(API.delete),
put: angularify(API.put),
patch: angularify(API.patch),
options: angularify(API.options),
login: angularify(API.login),
logout: API.logout,
autorenew: API.autorenew,
Expand Down

0 comments on commit 03dfdf2

Please sign in to comment.