-
-
Save 0xMH/16714bbae4888e0d0a63c09d68b95fb5 to your computer and use it in GitHub Desktop.
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
/** | |
* Authentication | |
* @namespace thinkster.authentication.services | |
* Make a file in static/javascripts/authentication/services/ called authentication.service.js | |
*/ | |
(function () { | |
'use strict'; | |
angular | |
.module('thinkster.authentication.services') | |
.factory('Authentication', Authentication); | |
Authentication.$inject = ['$cookies', '$http']; | |
/** | |
* @namespace Authentication | |
* @returns {Factory} | |
*/ | |
function Authentication($cookies, $http) { | |
/** | |
* @name Authentication | |
* @desc The Factory to be returned | |
*/ | |
var Authentication = { | |
register: register | |
}; | |
return Authentication; | |
//////////////////// | |
/** | |
* @name register | |
* @desc Try to register a new user | |
* @param {string} username The username entered by the user | |
* @param {string} password The password entered by the user | |
* @param {string} email The email entered by the user | |
* @returns {Promise} | |
* @memberOf thinkster.authentication.services.Authentication | |
*/ | |
function register(email, password, username) { | |
return $http.post('/api/v1/accounts/', { | |
username: username, | |
password: password, | |
email: email | |
}); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment