Skip to content

Commit d619e0b

Browse files
authored
Merge pull request #25 from marcode24/dev-2024
🐛 Fix authService method call in sidebar, website service, features c…
2 parents 43569a0 + 73cbc15 commit d619e0b

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

src/app/core/components/sidebar/sidebar.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class SidebarComponent implements OnInit, AfterViewInit, OnDestroy {
2424
private authService: AuthService,
2525
private router: Router
2626
) {
27-
this.userActive = authService.getUserActive;
27+
this.userActive = authService.getUserActive();
2828
}
2929

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

5252
setUserInfoActive(): void {
53-
this.userActive = this.authService.getUserActive;
53+
this.userActive = this.authService.getUserActive();
5454
}
5555

5656
get getName(): string {

src/app/core/services/website.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class WebsiteService {
2424
const url = `${base_url}/website?all=${all}&limit=${limit}&skip=${skip}`;
2525
return this.http.get<IResponseWebsite>(url).pipe(map(resp => {
2626
const { websites } = resp;
27-
const userActive = this.authService.getUserActive;
27+
const userActive = this.authService.getUserActive();
2828
if(userActive) {
2929
const { subscriptions } = userActive;
3030
websites.map(website => website.inUser = subscriptions?.includes(website._id));

src/app/features/features.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class FeaturesComponent {
1919
private settingService: SettingService ) {
2020
authService.validateToken().subscribe(() => {
2121
this.isLoading = false;
22-
const userActive: User = authService.getUserActive;
22+
const userActive: User = authService.getUserActive();
2323
if(userActive) {
2424
settingService.setTheme(userActive.darkMode ? 'dark' : 'light');
2525
}

src/app/features/settings/components/user-form/user-form.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class UserFormComponent implements OnInit {
2828
) { }
2929

3030
ngOnInit(): void {
31-
this.userActive = this.authService.getUserActive;
31+
this.userActive = this.authService.getUserActive();
3232
this.loadForm();
3333
}
3434

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<input [checked]="isDarkMode" type="checkbox" (change)="changeTheme($event.target)" id="toggle_checkbox">
1+
<input [checked]="isDarkMode" type="checkbox" (change)="changeTheme($event)" id="toggle_checkbox">
22
<label for="toggle_checkbox">
33
<div id="star">
44
<div class="star" id="star-1"></div>
55
<div class="star" id="star-2"></div>
66
</div>
77
<div id="moon"></div>
8-
</label>
8+
</label>

src/app/shared/toggle-theme/toggle-theme.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export class ToggleThemeComponent {
2222
.subscribe(checked => this.userService.setTheme(checked));
2323
}
2424

25-
changeTheme(event: HTMLInputElement) {
26-
const checked = event.checked;
25+
changeTheme(event: Event): void {
26+
const checked = (event.target as HTMLInputElement)?.checked;
2727
if(this.authService.isAuthenticated()) {
2828
this.themeChanged.next(checked);
2929
}

src/environments/environment.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export const environment = {
22
production: false,
3-
base_url: 'http://localhost:5000/api',
3+
base_url: 'http://localhost:5000/api/v1',
44
};

0 commit comments

Comments
 (0)