Advertisement
Guest User

Untitled

a guest
Oct 31st, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. * Authentication
  3. * @namespace thinkster.authentication.services
  4. */
  5. (function () {
  6.   'use strict';
  7.  
  8.   angular
  9.     .module('thinkster.authentication.services')
  10.     .factory('Authentication', Authentication);
  11.  
  12.   Authentication.$inject = ['$cookies', '$http'];
  13.  
  14.   /**
  15.   * @namespace Authentication
  16.   * @returns {Factory}
  17.   */
  18.   function Authentication($cookies, $http) {
  19.     /**
  20.     * @name Authentication
  21.     * @desc The Factory to be returned
  22.     */
  23.     var Authentication = {
  24.       register: register
  25.     };
  26.  
  27.     return Authentication;
  28.  
  29.     ////////////////////
  30.  
  31.     /**
  32.     * @name register
  33.     * @desc Try to register a new user
  34.     * @param {string} username The username entered by the user
  35.     * @param {string} password The password entered by the user
  36.     * @param {string} email The email entered by the user
  37.     * @returns {Promise}
  38.     * @memberOf thinkster.authentication.services.Authentication
  39.     */
  40.     function register(email, password, username) {
  41.       return $http.post('/api/v1/accounts/', {
  42.         username: username,
  43.         password: password,
  44.         email: email
  45.       });
  46.     }
  47.   }
  48. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement