Skip to content

Commit

Permalink
Merge pull request #25 from marcode24/dev-2024
Browse files Browse the repository at this point in the history
🐛 Fix authService method call in sidebar, website service, features c…
  • Loading branch information
marcode24 authored Jul 10, 2024
2 parents 43569a0 + 73cbc15 commit d619e0b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
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',
};

0 comments on commit d619e0b

Please sign in to comment.