Advertisement
Guest User

Untitled

a guest
Nov 11th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. controllersAdmin.controller('login', function( $scope, $http, store){
  2.  
  3. $scope.user = {};
  4.  
  5.    $scope.formSubmit = function (user){
  6.  
  7.       $http({
  8.       method: 'POST', url: 'api/admin/users/login/' ,
  9.       data: {
  10.         email : user.email,
  11.         password : user.password
  12.       }}
  13.       ).then(function ( data ){
  14.  
  15.         $scope.submit = true;
  16.         $scope.error = data.error;
  17.  
  18.         if ( !data.error )
  19.         {
  20.           store.set( 'token' , data.token );
  21.           console.log( store.get( 'token' ) );
  22.         }
  23.        
  24.              
  25.    },function (error){
  26.       console.log('Blad we wczytywaniu danych');
  27.    });
  28.    };
  29.  
  30.  
  31.  
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement