Skip to content

Instantly share code, notes, and snippets.

@simonmorley
Last active August 29, 2015 14:13
Show Gist options
  • Save simonmorley/63cd5d944ce4af5a2ccb to your computer and use it in GitHub Desktop.
Save simonmorley/63cd5d944ce4af5a2ccb to your computer and use it in GitHub Desktop.
medium, creating a login, integrating meraki, creating a cllient.details service full
var app = angular.module('ctLoginsApp.tony.services', ['ngResource']);
app.factory('Client', ['$routeParams', '$q', '$rootScope', '$location',
function($routeParams, $q, $rootScope, $location) {
var clientMac, apMac, redirectUri, loginUri, apTags, requestUri;
var details = function() {
var deferred = $q.defer();
if ($rootScope.deviceId === '1') {
clientMac = $routeParams.mac;
apMac = $routeParams.called;
redirectUri = $routeParams.userurl;
} else if ($rootScope.deviceId === '2') {
clientMac = $routeParams.mac;
apMac = $routeParams.apname.split(' ')[0];
redirectUri = $routeParams.url;
apTags = $routeParams.essid;
loginUri = $routeParams.switchip;
} else if ($rootScope.deviceId === '3') {
clientMac = $routeParams.client_mac;
apMac = $routeParams.ap_mac;
redirectUri = $routeParams.continue_url;
loginUri = $routeParams.login_url;
apTags = $routeParams.ap_tags;
}
var obj = { clientMac: clientMac, apMac: apMac, redirectUri: redirectUri, deviceId: $rootScope.deviceId, loginUri: loginUri, apTags: apTags, requestUri: $location.host()};
deferred.resolve(obj);
return deferred.promise;
};
return {
details: details
};
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment