<commit_before>'use strict';

module.exports = ['$q', '$log', '$http', 'authService', profileService];

function profileService($q, $log, $http, authService) {
  $log.debug('profileService');

  let service = {};
  service.profile = {};

  service.createProfile = function(profile) {
    $log.debug('profileService.createProfile');

    return authService.getToken()
    .then( token => {
      let url = `${__API_URL__}/api/profile` //eslint-disable-line
      let config = {
        headers: {
          Accept: 'application/json',
          'Content-Type': 'application/json',
          Authorization: `Bearer ${token}`
        }
      };

      return $http.post(url, profile, config);
    })
    .then( res => {
      $log.log('profile creation success');
      service.profile = res.data;<commit_msg>Woohoo profile service and create-profile component are wired up and working to upload a photo to s3 and save a profile to the database.<commit_after>'use strict';

module.exports = ['$q', '$log', '$http', 'Upload', 'authService', profileService];

function profileService($q, $log, $http, Upload, authService) {
  $log.debug('profileService');

  let service = {};
  service.profile = {};

  service.createProfile = function(profile) {
    $log.debug('profileService.createProfile');

    return authService.getToken()
    .then( token => {
      let url = `${__API_URL__}/api/profile` //eslint-disable-line
      let headers = {
        Accept: 'application/json',
        'Content-Type': 'application/json',
        Authorization: `Bearer ${token}`
      };

      return Upload.upload({
        url,
        headers,
        method: 'POST',
        data: {
          displayName: profile.displayName,
          fullName: profile.fullName,
          address: profile.address,
          bio: profile.bio,
          photo: profile.photo
        }
      });
    })
    .then( res => {
      $log.log('profile creation success');
      service.profile = res.data;
{'fraction_non_alphanumeric': 0.14989837398373984, 'fraction_numerical': 0.0005081300813008131, 'mean_word_length': 2.7011278195488724, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '792372', 'n_tokens_mistral': 572, 'n_tokens_neox': 563, 'n_words': 134}