Skip to content

Commit

Permalink
Angular Firebase Course
Browse files Browse the repository at this point in the history
  • Loading branch information
jhades committed Nov 23, 2018
1 parent 98c8f53 commit 1e71554
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions init-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async function uploadData() {

const courseLessons = findLessonsForCourse(course.id);

console.log('Adding lessons: ' + courseLessons.length);
//console.log(`Adding ${courseLessons.length} lessons to ${course.description}`);

courseLessons.forEach(async lesson => {

Expand Down Expand Up @@ -77,14 +77,14 @@ function removeId(data:any) {

uploadData()
.then(() => {
console.log("Writing data, exiting in 5 seconds ...\n\n");
console.log("Writing data, exiting in 10 seconds ...\n\n");

setTimeout(() => {

console.log("\n\n\nData Upload Completed.\n\n\n");
process.exit(0);

}, 5000);
}, 10000);

})
.catch(err => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const routes: Routes = [
component: AboutComponent
},
{
path: 'courses/:id',
path: 'courses/:courseUrl',
component: CourseComponent,
resolve: {
course: CourseResolver
Expand Down
2 changes: 1 addition & 1 deletion src/app/courses-card-list/courses-card-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<mat-card-actions class="course-actions">

<button mat-button class="mat-raised-button mat-primary" [routerLink]="['/courses', course.id]">
<button mat-button class="mat-raised-button mat-primary" [routerLink]="['/courses', course.url]">
VIEW COURSE
</button>

Expand Down
2 changes: 1 addition & 1 deletion src/app/services/course.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class CourseResolver implements Resolve<Course> {
}

resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Course> {
return this.coursesService.findCourseById(route.params['id'])
return this.coursesService.findCourseByUrl(route.params['courseUrl'])
.pipe(
first()
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/courses.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class CoursesService {
}

findCourseByUrl(courseUrl: string): Observable<Course> {
return this.db.collection('courses', ref => ref.where("courseUrl", "==", courseUrl) )
return this.db.collection('courses', ref => ref.where("url", "==", courseUrl) )
.snapshotChanges()
.pipe(
map(snaps => {
Expand Down

0 comments on commit 1e71554

Please sign in to comment.