You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1 KiB

  1. 'use strict';
  2. angular.module('app.signup', ['ngRoute'])
  3. .config(['$routeProvider', function($routeProvider) {
  4. $routeProvider.when('/signup', {
  5. templateUrl: 'views/signup/signup.html',
  6. controller: 'SignupCtrl'
  7. });
  8. }])
  9. .controller('SignupCtrl', function($scope, $http, $routeParams) {
  10. $scope.user = {};
  11. $scope.doLogin = function() {
  12. console.log('Doing login', $scope.user);
  13. $http({
  14. url: urlapi + 'admin/signup',
  15. method: "POST",
  16. data: $scope.user
  17. })
  18. .then(function(response) {
  19. console.log("response: ");
  20. console.log(response.data);
  21. if (response.data.success == true)
  22. {
  23. localStorage.setItem("cic_admin_token", response.data.token);
  24. localStorage.setItem("cic_admin_userdata", JSON.stringify(response.data.user));
  25. window.location.reload();
  26. }else{
  27. console.log("login failed");
  28. }
  29. },
  30. function(response) { // optional
  31. // failed
  32. console.log(response);
  33. });
  34. };
  35. });