Created
January 22, 2015 19:13
-
-
Save simonmorley/269a3c8c6f66e3087d2f to your computer and use it in GitHub Desktop.
Medium, creating a splash page, xirrus service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var app = angular.module('ctLoginsApp.xirrus.services', ['ngResource']); | |
| app.factory('Xirrus', ['$http', '$q', | |
| function($http, $q){ | |
| var login = function(params) { | |
| $http.defaults.headers.common = {}; | |
| $http.defaults.headers.post = {}; | |
| var request = $http({ | |
| method: 'GET', | |
| url: 'http://' + params.uamip + ':' + params.uamport + '/logon?', | |
| headers: { | |
| 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', | |
| }, | |
| data: $.param({ | |
| username: params.username, | |
| response: params.response | |
| }) | |
| }); | |
| return( request.then( handleSuccess, handleError ) ); | |
| }; | |
| var handleError = function() { | |
| return( true ); | |
| }; | |
| var handleSuccess = function(response) { | |
| return( response.data ); | |
| }; | |
| return { | |
| login: login | |
| }; | |
| }]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment