<commit_before>import {inject} from 'aurelia-framework';
import {Router} from 'aurelia-router';
import {HttpClient, json} from 'aurelia-fetch-client';
import 'fetch';

@inject(HttpClient, Router)
export class EditClient {
  heading = 'Edit Client';
  submitText = 'Update Client';

  name = "";
  id = "";
  enabled = true;
  claimsUri = "";

  isNewClient = false;
  clientAdded = false;

  constructor(http, router) {
    http.configure(config => {
      config
        .useStandardConfiguration()
        .withBaseUrl('http://localhost:56627');
    });

    this.http = http;
    this.router = router;
  }

  activate(params) {
    this.id = params.id;
    this.isNewClient = !this.id;

    if (this.isNewClient) {
      this.heading = "New Client";
      this.submitText = "Add Client";
    } else {
      return this.http.fetch('/api/clients/' + this.id)
        .then(response => response.json(), response => {
          console.error("Error getting client " + this.id + ": " + JSON.stringify());
          this.errorMessage = "Error getting client " + this.id;
        })
        .then(client => {
          this.name = client.name;
          this.enabled = client.enabled;
          this.claimsUri = client.claimsUri;
        });
    }
  }

  submit() {
    var client = {
      id: this.id,
      name: this.name,
      enabled: this.enabled,
      claimsUri: this.claimsUri
    };
    if (this.isNewClient) {
      this.http.fetch('/api/clients', {
        method: 'post',
        body: json(client)
      })
        .then(response => {
          this.clientAdded = true;
        }, response => {
          console.error("Error creating client: " + JSON.stringify(response));
          this.errorMessage = "Error creating client";
        });
    } else {
      this.http.fetch('/api/clients/' + this.id, {
        method: 'put',
        body: json(client)
      })
        .then(response => {
          console.log("Client updated!");
        }, response => {
          console.error("Error updating client " + this.id + ": " + JSON.stringify(response));
          this.errorMessage = "Error updating client";
        });
    }
  }

  manage() {
    this.router.navigateToRoute('manageClient', { id: this.id });
  }
}
<commit_msg>Correcting URI for users api<commit_after>import {inject} from 'aurelia-framework';
import {Router} from 'aurelia-router';
import {HttpClient, json} from 'aurelia-fetch-client';
import 'fetch';

@inject(HttpClient, Router)
export class EditClient {
  heading = 'Edit Client';
  submitText = 'Update Client';

  name = "";
  id = "";
  enabled = true;
  claimsUri = "";

  isNewClient = false;
  clientAdded = false;

  constructor(http, router) {
    http.configure(config => {
      config
        .useStandardConfiguration()
        .withBaseUrl('https://localhost:44392');
    });

    this.http = http;
    this.router = router;
  }

  activate(params) {
    this.id = params.id;
    this.isNewClient = !this.id;

    if (this.isNewClient) {
      this.heading = "New Client";
      this.submitText = "Add Client";
    } else {
      return this.http.fetch('/api/clients/' + this.id)
        .then(response => response.json(), response => {
          console.error("Error getting client " + this.id + ": " + JSON.stringify());
          this.errorMessage = "Error getting client " + this.id;
        })
        .then(client => {
          this.name = client.name;
          this.enabled = client.enabled;
          this.claimsUri = client.claimsUri;
        });
    }
  }

  submit() {
    var client = {
      id: this.id,
      name: this.name,
      enabled: this.enabled,
      claimsUri: this.claimsUri
    };
    if (this.isNewClient) {
      this.http.fetch('/api/clients', {
        method: 'post',
        body: json(client)
      })
        .then(response => {
          this.clientAdded = true;
        }, response => {
          console.error("Error creating client: " + JSON.stringify(response));
          this.errorMessage = "Error creating client";
        });
    } else {
      this.http.fetch('/api/clients/' + this.id, {
        method: 'put',
        body: json(client)
      })
        .then(response => {
          console.log("Client updated!");
        }, response => {
          console.error("Error updating client " + this.id + ": " + JSON.stringify(response));
          this.errorMessage = "Error updating client";
        });
    }
  }

  manage() {
    this.router.navigateToRoute('manageClient', { id: this.id });
  }
}

{'fraction_non_alphanumeric': 0.151622943530458, 'fraction_numerical': 0.0022232103156958646, 'mean_word_length': 2.179505300353357, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 1, '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': '3103918', 'n_tokens_mistral': 1377, 'n_tokens_neox': 1346, 'n_words': 276}