File tree Expand file tree Collapse file tree 4 files changed +9
-5
lines changed
public/project/components Expand file tree Collapse file tree 4 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 1919 < a [routerLink] ='["/Login"] '> Sign In</ a >
2020 </ li >
2121 < li *ngIf ="isActiveUser() " [class.active] ="isRouteActive('user') ">
22- < a [routerLink] ='["/User", { user: userService.getActiveUser().id }] '> Profile Icon</ a >
22+ < a [routerLink] ='["/User", { user: userService.getActiveUser()._id }] '> Profile Icon</ a >
2323 </ li >
2424 < li *ngIf ="isActiveUser() ">
2525 < a > Notifications Icon</ a >
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ export class User {
4545 if ( this . newLibraryName ) {
4646 let newLib : any = { }
4747 newLib . name = this . newLibraryName
48+ newLib . user = this . user
4849 this . libraryService . addLibrary ( newLib )
4950 . subscribe ( resp => {
5051 if ( resp . json ( ) . library ) {
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ <h1>{{user.username}}</h1>
1616 < div >
1717 < h3 > Libraries</ h3 >
1818 < div class ="new-library " *ngIf ='hasEditRights() '>
19- < input type ="text " [(ngClass )] ="newLibraryName " placeholder ="Library name ">
19+ < input type ="text " [(ngModel )] ="newLibraryName " placeholder ="Library name ">
2020 < button class ="btn btn-default " (click) ='newLibrary() '> +</ button >
2121 </ div >
2222 < div class ="library-carousel ">
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export default class Database {
3333 }
3434
3535 createUser ( user ) {
36- user . _id = ( this . randomId ++ ) . toString ( )
36+ user . _id = this . randomId ++
3737 if ( _ . find ( this . users , u => { return u . username === user . username } ) ) {
3838 return { error : "duplicate username!" }
3939 }
@@ -78,10 +78,13 @@ export default class Database {
7878 }
7979
8080 createLibrary ( library ) {
81- library . id = ( this . randomId ++ ) . toString ( )
81+ library . id = this . randomId ++
8282 this . libraries . push ( library )
8383 const user = library . user
84- _ . find ( this . users , u => { return u . _id === user . id } ) . libraries . push ( library )
84+ console . log ( user )
85+ const dbUser = _ . find ( this . users , u => { return u . _id === user . _id } )
86+ console . log ( dbUser )
87+ dbUser . libraries . push ( library )
8588 return library
8689 }
8790
You can’t perform that action at this time.
0 commit comments