Skip to content
Snippets Groups Projects
Commit c4172983 authored by pnogal's avatar pnogal Committed by Paulina Nogal
Browse files

Add missing user profile information

parent 5db7c880
No related branches found
No related tags found
No related merge requests found
import { Component, ViewChild, OnInit } from '@angular/core';
import { MatSidenav, MatDialog } from '@angular/material';
import { Observable } from 'rxjs';
import { Profile } from '@app/core/models/profile';
import {
FormBuilder,
FormGroup,
......@@ -20,6 +21,7 @@ export class AppComponent implements OnInit {
coursesData$: any;
selectedDegreePlan: number;
courses: Course[];
profile: Profile;
coursesForm: FormGroup;
subjectCode: FormControl;
@ViewChild('rightAddCourse') public rightAddCourse: MatSidenav;
......@@ -45,7 +47,18 @@ export class AppComponent implements OnInit {
// );
}
ngOnInit() {}
ngOnInit() {
this.api.getUserProfile().subscribe(profile => {
const customEvent = new CustomEvent('myuw-login', {
detail: {
person: {
firstName: profile.firstName,
},
},
});
document.dispatchEvent(customEvent);
});
}
openCourseDetailsDialog(course) {
this.api
......@@ -60,14 +73,3 @@ export class AppComponent implements OnInit {
});
}
}
document.addEventListener('WebComponentsReady', function() {
const customEvent = new CustomEvent('myuw-login', {
detail: {
person: {
// 'firstName': 'Bucky'
},
},
});
document.dispatchEvent(customEvent);
});
export interface Profile {
pvi: string;
username: string;
fullName: string;
emailAddress: string;
firstName: string;
lastName: string;
displayName: string;
}
......@@ -14,6 +14,7 @@ import { Note } from '@app/core/models/note';
import { Term } from '@app/core/models/term';
import { CourseBase, SubjectMapping } from '@app/core/models/course';
import { DegreePlan } from '@app/core/models/degree-plan';
import { Profile } from '@app/core/models/profile';
import { SavedForLaterCourseBase } from '@app/core/models/saved-for-later-course';
import { SearchResults } from '@app/core/models/search-results';
import { TermCode } from '@app/core/models/termcode';
......@@ -56,6 +57,10 @@ export class DegreePlannerApiService {
return this.http.delete<void>(url);
}
public getUserProfile(): Observable<Profile> {
return this.http.get<Profile>(`/profile`, HTTP_OPTIONS);
}
public getAllDegreePlans(): Observable<DegreePlan[]> {
return this.http.get<DegreePlan[]>(this.degreePlanEndpoint(), HTTP_OPTIONS);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment