Fixes issue of moving/deleting media along with other issues of us returning plain text responses with incorrect mime type results and an issue with our interceptors

This commit is contained in:
Shannon
2018-08-08 11:49:05 +10:00
parent 4a43b97f64
commit 9e6947f62c
14 changed files with 69 additions and 29 deletions

View File

@@ -48,11 +48,14 @@
//exit/ignore
return $q.reject(rejection);
}
var filtered = _.find(requestInterceptorFilter(), function (val) {
return config.url.indexOf(val) > 0;
});
if (filtered) {
return $q.reject(rejection);
if (config.url) {
var filtered = _.find(requestInterceptorFilter(), function (val) {
return config.url.indexOf(val) > 0;
});
if (filtered) {
return $q.reject(rejection);
}
}
//A 401 means that the user is not logged in

View File

@@ -157,7 +157,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
{
parentId: args.parentId,
id: args.id
}),
}, { responseType: 'text' }),
'Failed to move content');
},
@@ -198,7 +198,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
return umbRequestHelper.resourcePromise(
$http.post(umbRequestHelper.getApiUrl("contentApiBaseUrl", "PostCopy"),
args),
args, { responseType: 'text' }),
'Failed to copy content');
},
@@ -467,7 +467,8 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
$http.get(
umbRequestHelper.getApiUrl(
"contentApiBaseUrl",
"GetNiceUrl", [{ id: id }])),
"GetNiceUrl", { id: id }),
{ responseType: 'text' }),
'Failed to retrieve url for id:' + id);
},

View File

@@ -266,7 +266,7 @@ function contentTypeResource($q, $http, umbRequestHelper, umbDataFormatter, loca
{
parentId: args.parentId,
id: args.id
}),
}, { responseType: 'text' }),
'Failed to move content');
},
@@ -286,7 +286,7 @@ function contentTypeResource($q, $http, umbRequestHelper, umbDataFormatter, loca
{
parentId: args.parentId,
id: args.id
}),
}, { responseType: 'text' }),
'Failed to copy content');
},

View File

@@ -344,7 +344,7 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) {
{
parentId: args.parentId,
id: args.id
}),
}, { responseType: 'text' }),
'Failed to move content');
},

View File

@@ -112,7 +112,7 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
{
parentId: args.parentId,
id: args.id
}),
}, {responseType: 'text'}),
'Failed to move media');
},

View File

@@ -213,7 +213,7 @@ function mediaTypeResource($q, $http, umbRequestHelper, umbDataFormatter) {
{
parentId: args.parentId,
id: args.id
}),
}, { responseType: 'text' }),
'Failed to move content');
},
@@ -233,7 +233,7 @@ function mediaTypeResource($q, $http, umbRequestHelper, umbDataFormatter) {
{
parentId: args.parentId,
id: args.id
}),
}, { responseType: 'text' }),
'Failed to copy content');
},

View File

@@ -152,6 +152,13 @@ function umbRequestHelper($http, $q, umbDataFormatter, angularHelper, dialogServ
}, function (response) {
if (!response.status && response.message && response.stack) {
//this is a JS/angular error that we should deal with
return $q.reject({
errorMsg: response.message
})
}
//invoke the callback
var result = callbacks.error.apply(this, [response.data, response.status, response.headers, response.config]);