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.

36 lines
906 B

  1. 'use strict';
  2. angular.module('app.login', ['ngRoute'])
  3. .config(['$routeProvider', function($routeProvider) {
  4. $routeProvider.when('/login', {
  5. templateUrl: 'views/login/login.html',
  6. controller: 'LoginCtrl'
  7. });
  8. }])
  9. .controller('LoginCtrl', function($scope, $rootScope, $http, $routeParams, toastr) {
  10. $rootScope.server = ""
  11. $scope.user = {};
  12. $scope.login = function() {
  13. $http({
  14. url: apiurl + 'login',
  15. method: "POST",
  16. headers: {
  17. "Content-Type": undefined
  18. },
  19. data: $scope.user
  20. })
  21. .then(function(data) {
  22. console.log("data: ");
  23. console.log(data.data);
  24. localStorage.setItem("dblog_user", JSON.stringify(data.data));
  25. window.location.reload();
  26. },
  27. function(data) {
  28. console.log(data);
  29. });
  30. };
  31. });