Skip to content

Commit

Permalink
Added license, TodoListService - use BASE_URL-from weather_scope branch
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoodearl committed Jul 6, 2019
1 parent c911ef8 commit 104dedc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,7 @@ ASALocalRun/
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb

# Ignore folders starting with _Local or _Local
_[Ll]ocal*
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class FetchDataComponent {
public forecasts: WeatherForecast[];

constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
console.log("FetchDataComponent BASE_URL=[" + baseUrl + "]");
http.get<WeatherForecast[]>(baseUrl + 'api/SampleData/WeatherForecasts').subscribe(result => {
this.forecasts = result;
}, error => console.error(error));
Expand Down
11 changes: 6 additions & 5 deletions TodoSPA/ClientApp/src/app/todo-list/todo-list.service.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import {Injectable} from "@angular/core";
import { Injectable, Inject } from "@angular/core";
import {HttpClient} from "@angular/common/http";
import {Observable} from "rxjs";
import {TodoList} from "./todoList";
import { map, catchError } from 'rxjs/operators';

@Injectable()
export class TodoListService {
static VER: string = "1.01";
static VER: string = "1.02";

private apiEndpoint: string = "https://localhost:44358/api/todo";
private apiEndpoint: string = null; //"https://localhost:44358/api/todo";

constructor(private http: HttpClient) {
console.log("todoListSvc constructor v=" + TodoListService.VER);
constructor(private http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
console.log("todoListSvc constructor v=" + TodoListService.VER + " - baseUrl=[" + baseUrl + "]");
this.apiEndpoint = baseUrl + "api/todo";
}

getItems(): Observable<TodoList[]> {
Expand Down
4 changes: 3 additions & 1 deletion TodoSPA/ClientApp/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

export function getBaseUrl() {
return document.getElementsByTagName('base')[0].href;
let baseUrl: string = document.getElementsByTagName('base')[0].href;
console.log("main - baseUrl=[" + baseUrl + "]");
return baseUrl;
}

const providers = [
Expand Down
1 change: 1 addition & 0 deletions TodoSPASample.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5EEC8370-5BFC-4D96-9C26-FF9ECD501716}"
ProjectSection(SolutionItems) = preProject
_docs\AzureADResources.md = _docs\AzureADResources.md
LICENSE = LICENSE
_docs\MS_Identity_Web.md = _docs\MS_Identity_Web.md
readme.md = readme.md
_docs\TSS_DevNotes.md = _docs\TSS_DevNotes.md
Expand Down
8 changes: 8 additions & 0 deletions _docs/TSS_DevNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<th>Dev</th>
<th>Notes</th>
</tr>
<tr>
<td>7/6/2019</td><td>bg</td>
<td>
Added license.<br/>
Picked up some changes from weather_scope branch.
TodoListService - use BASE_URL to set up URL for api/todo.<br/>
</td>
</tr>
<tr>
<td>7/2/2019</td><td>bg</td>
<td>
Expand Down

0 comments on commit 104dedc

Please sign in to comment.