First time poster! I am using dreamfactory for a school project revolving around the selling of textbooks. When a user creates an account, they will enter their basic user credentials and a post request is made to user/register and the user is logged in. They are then taken to a second webpage where they enter their twitter credentials, and the school they go to. These are then supposed to be posted to user/custom, however I am getting these errors when I try:
When doing this directly in the API docs with a user of the app, it works, but not in the app! Here is the relevant code:
.config([
'$routeProvider',
function ($routeProvider) {
$routeProvider
.when('/login', {
title : 'Login',
controller : 'LoginCtrl',
templateUrl : 'app/login/login.html'
})
.when('/register', {
title : 'Register',
controller : 'RegisterController',
templateUrl : 'app/login/register.html'
})
.when('/register2',{
title : 'RegisterCustoms',
controller : 'RegisterCustomsController',
templateUrl : 'app/login/register2.html',
resolve : {
custom: function () {
return { };
}
}
});
}
])
.factory('Customs', [
'$resource',
function ($resource) {
return $resource('api/v2/user/custom/:id', { id: '@id' }, {
query: {
method: 'GET',
isArray: false
},
create: {
method: 'POST'
},
update: {
method: 'PUT'
},
remove: {
method: 'DELETE'
}
});
}
])
.controller('RegisterCustomsController', [
'$scope', 'Customs', 'custom','$location', '$mdToast', '$mdDialog',
function($scope, Customs, custom, $location, $mdToast, $mdDialog, $mdScope){
$scope.states = ['States go He'];
$scope.schools =['1'];
$scope.register = function(){
//$scope.custom = angular.copy(custom);
console.log($scope.custom)
Customs.create({
twitterUsername: $scope.custom.twitterUsername,
twitterPassword: $scope.custom.twitterPassword,
schoolID: $scope.custom.selectedSchool
}).$promise.then(function(){
$location.path('/hompeage');
$mdToast.show($mdToast.simple().content('Welcome new user!'));
$mdDialog.hide($mdScope.book);
});
}
}
])