mirror of
https://github.com/arnaucube/decentralized-blogging-platform.git
synced 2026-02-07 19:36:40 +01:00
signup and login working
This commit is contained in:
34
webapp/views/signup/signup.js
Executable file
34
webapp/views/signup/signup.js
Executable file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('app.signup', ['ngRoute'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/signup', {
|
||||
templateUrl: 'views/signup/signup.html',
|
||||
controller: 'SignupCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('SignupCtrl', function($scope, $http, $routeParams, $rootScope) {
|
||||
$scope.signup = function() {
|
||||
console.log('Doing signup', $scope.user);
|
||||
$http({
|
||||
url: apiurl + 'signup',
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": undefined
|
||||
},
|
||||
data: $scope.user
|
||||
})
|
||||
.then(function(data) {
|
||||
console.log("data: ");
|
||||
console.log(data.data);
|
||||
window.location="/#!/login";
|
||||
|
||||
},
|
||||
function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user