Fix: HTTP handling was broken after updating libs.

This commit is contained in:
baldo 2016-06-07 14:40:05 +02:00
parent 03083b819b
commit c3d527f2bc
5 changed files with 14 additions and 13 deletions

View file

@ -9,10 +9,11 @@ angular.module('ffffng')
$scope.onSubmitToken = function (token) {
$scope.token = token;
return NodeService.getNode(token)
.success(function (node) {
.then(function (response) {
var node = response.data;
ConfirmDeletionDialog.open(node).result.then(function () {
NodeService.deleteNode(token)
.success(function () {
.then(function () {
$scope.deleted = true;
$scope.hostname = node.hostname;
});

View file

@ -16,9 +16,9 @@ angular.module('ffffng')
$scope.save = function (node) {
return NodeService.createNode(node)
.success(function (response) {
$scope.node = response.node;
$scope.token = response.token;
.then(function (response) {
$scope.node = response.data.node;
$scope.token = response.data.token;
$scope.saved = true;
});
};

View file

@ -21,9 +21,9 @@ angular.module('ffffng')
$scope.save = function (node) {
return NodeService.updateNode(node, $scope.token)
.success(function (response) {
$scope.node = response.node;
$scope.token = response.token;
.then(function (response) {
$scope.node = response.data.node;
$scope.token = response.data.token;
$scope.saved = true;
});
};

View file

@ -159,11 +159,11 @@ angular.module('ffffng')
}
$scope.error = null;
$scope.save(node).catch(function (response, code) {
$scope.save(node).catch(function (response) {
// error
switch (code) {
switch (response.status) {
case 409: // conflict
$scope.error = duplicateError[response.field];
$scope.error = duplicateError[response.data.field];
break;
default:
$scope.error = 'Es ist ein Fehler aufgetreten. Versuche es später noch einmal.';

View file

@ -15,8 +15,8 @@ angular.module('ffffng')
$scope.error = null;
$scope.onSubmit(token)
.catch(function (response, code) {
switch (code) {
.catch(function (response) {
switch (response.status) {
case 404: // not found
$scope.error = 'Zum Token wurde kein passender Eintrag gefunden.';
break;