-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Angular - NgRx - SCSS] 440: state & service refactor (#527)
* setup: get branch caught up and ready for work * feat: refactored repository service and test * feat: refactor of user service and test * feat: updated user service spec * feat: created dashboard store files; updated global state files; renamed RepoState and updated all calls * attempt to fix issues with service updates; some refactoring and adjusting so app compiles * feat: added auth user data to auth state; updated nav component to use auth state * feat: adjusted auth call; fixed user call so home page loads * moved some user logic; still having reload issues and repo view issues * feat: got app working again! cleaned out console logs * rebased and fixed most files * fix broken tests * removed unused code * fix: fix pr comments and most tests * fix: fixed final broken unit test * fix: updated test; removed unused code in user effect; new user mapping file * add todo for refactor improvements; update authUser effect to use different rxjs operation Co-authored-by: LindaT <[email protected]>
- Loading branch information
Showing
43 changed files
with
2,657 additions
and
1,370 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
import { Store } from '@ngrx/store'; | ||
import { selectUserLoginName } from '../state/user'; | ||
import { Subject, takeUntil } from 'rxjs'; | ||
import { selectAuthUserName } from '../state/auth'; | ||
import { fetchUserData } from '../state/user/user.actions'; | ||
|
||
@Component({ | ||
selector: 'app-home', | ||
templateUrl: './home.component.html', | ||
styleUrls: ['./home.component.scss'], | ||
}) | ||
export class HomeComponent implements OnInit { | ||
user$ = this.store.select(selectUserLoginName); | ||
export class HomeComponent implements OnInit, OnDestroy { | ||
destroy$: Subject<boolean> = new Subject<boolean>(); | ||
user$ = this.store.select(selectAuthUserName); | ||
|
||
constructor(private store: Store) {} | ||
|
||
ngOnInit() { | ||
this.store.dispatch(fetchUserData()); | ||
this.user$.pipe(takeUntil(this.destroy$)).subscribe((user) => { | ||
this.store.dispatch(fetchUserData({ username: user })); | ||
}); | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.destroy$.next(true); | ||
this.destroy$.unsubscribe(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ss/src/app/repository/components/repo-header/repo-navigation/repo-navigation.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.