{"size": 802, "ext": "js", "max_stars_repo_path": "app/component/landing/signup/signup.js", "max_stars_repo_name": "renegadellama/JamShare", "max_stars_repo_stars_event_min_datetime": "2017-06-25T14:11:54.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-20T02:59:05.000Z", "max_issues_repo_path": "app/component/landing/signup/signup.js", "max_issues_repo_name": "renegadellama/JamShare", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/component/landing/signup/signup.js", "max_forks_repo_name": "renegadellama/JamShare", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.2777777778, "max_line_length": 78, "alphanum_fraction": 0.4962593516}
'use strict';

module.exports = {
  template: require('./signup.html'),
  controllerAs: 'signupCtrl',
  controller: [
    '$log',
    '$location',
    '$window',
    '$rootScope',
    'authService',
    'songService',
    function($log, $location, $window, $rootScope, authService, songService) {
      this.$onInit = () => {
        $log.debug('SignupController');

        if(!$window.localStorage.token) {
          authService.getToken()
          .then(
            () => $location.url('/home'),
            () => $location.url('/signup')
          );
        }
        this.title = 'Sign Up';

        this.signup = function(user) {
          $log.debug('signupCtrl.signup()');

          authService.signup(user)
          .then(() => $location.url('/home'));
        };
      };
    },
  ],
};
