Skip to content

šŸ› Fix authService method call in sidebar, website service, features c… #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/core/components/sidebar/sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class SidebarComponent implements OnInit, AfterViewInit, OnDestroy {
private authService: AuthService,
private router: Router
) {
this.userActive = authService.getUserActive;
this.userActive = authService.getUserActive();
}

ngOnDestroy(): void {
Expand All @@ -50,7 +50,7 @@ export class SidebarComponent implements OnInit, AfterViewInit, OnDestroy {
}

setUserInfoActive(): void {
this.userActive = this.authService.getUserActive;
this.userActive = this.authService.getUserActive();
}

get getName(): string {
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/services/website.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class WebsiteService {
const url = `${base_url}/website?all=${all}&limit=${limit}&skip=${skip}`;
return this.http.get<IResponseWebsite>(url).pipe(map(resp => {
const { websites } = resp;
const userActive = this.authService.getUserActive;
const userActive = this.authService.getUserActive();
if(userActive) {
const { subscriptions } = userActive;
websites.map(website => website.inUser = subscriptions?.includes(website._id));
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/features.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class FeaturesComponent {
private settingService: SettingService ) {
authService.validateToken().subscribe(() => {
this.isLoading = false;
const userActive: User = authService.getUserActive;
const userActive: User = authService.getUserActive();
if(userActive) {
settingService.setTheme(userActive.darkMode ? 'dark' : 'light');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class UserFormComponent implements OnInit {
) { }

ngOnInit(): void {
this.userActive = this.authService.getUserActive;
this.userActive = this.authService.getUserActive();
this.loadForm();
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/toggle-theme/toggle-theme.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<input [checked]="isDarkMode" type="checkbox" (change)="changeTheme($event.target)" id="toggle_checkbox">
<input [checked]="isDarkMode" type="checkbox" (change)="changeTheme($event)" id="toggle_checkbox">
<label for="toggle_checkbox">
<div id="star">
<div class="star" id="star-1">ā˜…</div>
<div class="star" id="star-2">ā˜…</div>
</div>
<div id="moon"></div>
</label>
</label>
4 changes: 2 additions & 2 deletions src/app/shared/toggle-theme/toggle-theme.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export class ToggleThemeComponent {
.subscribe(checked => this.userService.setTheme(checked));
}

changeTheme(event: HTMLInputElement) {
const checked = event.checked;
changeTheme(event: Event): void {
const checked = (event.target as HTMLInputElement)?.checked;
if(this.authService.isAuthenticated()) {
this.themeChanged.next(checked);
}
Expand Down
2 changes: 1 addition & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const environment = {
production: false,
base_url: 'http://localhost:5000/api',
base_url: 'http://localhost:5000/api/v1',
};
Loading