All resources now converted to using resourcePromise.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* @name umbraco.resources.mediaTypeResource
|
||||
* @description Loads in data for content types
|
||||
**/
|
||||
function mediaTypeResource($q, $http) {
|
||||
function mediaTypeResource($q, $http, angularHelper) {
|
||||
|
||||
/** internal method to get the api url */
|
||||
function getChildContentTypesUrl(contentId) {
|
||||
@@ -15,18 +15,10 @@ function mediaTypeResource($q, $http) {
|
||||
//return all types allowed under given document
|
||||
getAllowedTypes: function (contentId) {
|
||||
|
||||
var deferred = $q.defer();
|
||||
return angularHelper.resourcePromise(
|
||||
$http.get(getChildContentTypesUrl(contentId)),
|
||||
'Failed to retreive data for media id ' + contentId);
|
||||
|
||||
//go and get the tree data
|
||||
$http.get(getChildContentTypesUrl(contentId)).
|
||||
success(function (data, status, headers, config) {
|
||||
deferred.resolve(data);
|
||||
}).
|
||||
error(function (data, status, headers, config) {
|
||||
deferred.reject('Failed to retreive data for media id ' + contentId);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* @name umbraco.resources.section
|
||||
* @description Loads in data for section
|
||||
**/
|
||||
function sectionResource($q, $http) {
|
||||
function sectionResource($q, $http, angularHelper) {
|
||||
|
||||
/** internal method to get the tree app url */
|
||||
function getSectionsUrl(section) {
|
||||
@@ -13,13 +13,11 @@ function sectionResource($q, $http) {
|
||||
//the factory object returned
|
||||
return {
|
||||
/** Loads in the data to display the section list */
|
||||
getSections: function (options) {
|
||||
return $http.get(getSectionsUrl())
|
||||
.then(function (response) {
|
||||
return response.data;
|
||||
}, function (response) {
|
||||
throw new Error('Failed to retreive data for content id ' + id);
|
||||
});
|
||||
getSections: function () {
|
||||
|
||||
return angularHelper.resourcePromise(
|
||||
$http.get(getSectionsUrl()),
|
||||
'Failed to retreive data for sections');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user