Skip to content

Commit

Permalink
handle schema source
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Jun 2, 2016
1 parent f7424e0 commit 66f98fb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions public/app/schema/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ angular.module('fusioApp.schema', ['ngRoute', 'ui.bootstrap'])
};

$scope.create = function(schema){
if (typeof schema.source == 'string') {
schema.source = JSON.parse(schema.source);
}

$http.post(fusio_url + 'backend/schema', schema)
.success(function(data){
$scope.response = data;
Expand All @@ -154,9 +158,17 @@ angular.module('fusioApp.schema', ['ngRoute', 'ui.bootstrap'])

.controller('SchemaUpdateCtrl', ['$scope', '$http', '$uibModalInstance', '$uibModal', 'schema', function($scope, $http, $uibModalInstance, $uibModal, schema){

if (typeof schema.source != 'string') {
schema.source = JSON.stringify(schema.source, null, 4);
}

$scope.schema = schema;

$scope.update = function(schema){
if (typeof schema.source == 'string') {
schema.source = JSON.parse(schema.source);
}

$http.put(fusio_url + 'backend/schema/' + schema.id, schema)
.success(function(data){
$scope.response = data;
Expand Down

0 comments on commit 66f98fb

Please sign in to comment.