JSFiddle - React, Tailwind, and code Playground

JavaScript

angular.module('testApp')
  .factory('AuthService', function ($http) {
    var authService = {};
    authService.login = function (credentials) {
      return $http
        .post('http://localhost/test/login',credentials)
        .success(function (res) {          
          console.log('success');
          return res.id;
        }).error(function(){
          console.log('error');
        });
    };
      return authService;
  });